code first System.Data.Entity.Infrastructure.CommitFailedException: An error was reported while committing a database transaction but it could not be determined whether the transaction succeeded
System.Data.Entity.Infrastructure.CommitFailedException: An error was reported while committing a database transaction but it could not be determined whether the transaction succeeded or failed on the database server. See the inner exception and http://go.microsoft.com/fwlink/?LinkId=313468 for more information. ---> System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception: 等待的操作過時。
1、日志庫初始化空間設(shè)置過大,自增長設(shè)置為10%,當(dāng)超過初始值后每次分配的空間過大操作時備份操作日志比較慢超時導(dǎo)致的!https://q.cnblogs.com/q/88805/
2、在數(shù)據(jù)庫執(zhí)行一下命令就好了:exec sp_updatestats; http://www.rzrgm.cn/xujie520/p/10748435.html
3、檢查數(shù)據(jù)庫日志文件,發(fā)現(xiàn)日志文件大小四十多G,數(shù)據(jù)日志文件自動增長模式為10%來增長 相當(dāng)于一次性增長4個多G
sqlserver數(shù)據(jù)庫日志文件自動擴容時需要做很多的事情,非常消耗性能,因此再擴容期間;對于數(shù)據(jù)庫的操作就都會被延遲等等;等到文件擴容結(jié)束才能恢復(fù)正常
https://blog.csdn.net/liuci820/article/details/79927734
解決方案:
1.先對現(xiàn)有數(shù)據(jù)庫日志文件進行清理;采用壓縮方式將日志數(shù)據(jù)清理掉
2.修改日志文件自動增長方式;不要按照百分比進行增長,根據(jù)自己數(shù)據(jù)庫文件大小增長情況合理設(shè)置 ;一般設(shè)置一次增長再100—200M;
4、http://www.rzrgm.cn/Jesse-Li/p/7473178.html
5、設(shè)置sqlserver內(nèi)存占用只使用60%,保證內(nèi)存充足
6、數(shù)據(jù)庫連接字符串添加;MultipleActiveResultSets=True;

浙公網(wǎng)安備 33010602011771號