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、日志库初始化空间设置过大,自增长设置为10%,当超过初始值后每次分配的空间过大操作时备份操作日志比较慢超时导致的!https://q.cnblogs.com/q/88805/
2、在数据库执行一下命令就好了:exec sp_updatestats; https://www.cnblogs.com/xujie520/p/10748435.html

3、检查数据库日志文件,发现日志文件大小四十多G,数据日志文件自动增长模式为10%来增长  相当于一次性增长4个多G

     sqlserver数据库日志文件自动扩容时需要做很多的事情,非常消耗性能,因此再扩容期间;对于数据库的操作就都会被延迟等等;等到文件扩容结束才能恢复正常

     https://blog.csdn.net/liuci820/article/details/79927734
     解决方案:

    1.先对现有数据库日志文件进行清理;采用压缩方式将日志数据清理掉

    2.修改日志文件自动增长方式;不要按照百分比进行增长,根据自己数据库文件大小增长情况合理设置 ;一般设置一次增长再100—200M;

4、https://www.cnblogs.com/Jesse-Li/p/7473178.html

5、设置sqlserver内存占用只使用60%,保证内存充足

6、数据库连接字符串添加;MultipleActiveResultSets=True;

posted @ 2019-11-27 11:22  事理  阅读(1016)  评论(0编辑  收藏  举报