EF sqlite3報錯 "System.Data.Entity.Core.EntityException: 在提供程序連接上啟動事務時出錯。有關詳細信息,請參閱內部異常。


問題:sqlite3使用ef框架操作數據庫報錯

問題原因:數據庫文件沒有訪問權限

結局方案:可以將數據庫文件所在的文件夾的訪問權限添加Everyone用戶權限。

 

錯誤:"System.Data.Entity.Core.EntityException: 在提供程序連接上啟動事務時出錯。有關詳細信息,請參閱內部異常。 ---> System.Data.SQLite.SQLiteException: attempt to write a readonly database\r\nattempt to write a readonly database\r\n 在 System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)\r\n 在 System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)\r\n 在 System.Data.SQLite.SQLiteDataReader.NextResult()\r\n 在 System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)\r\n 在 System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)\r\n 在 System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)\r\n 在 System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()\r\n 在 System.Data.SQLite.SQLiteTransaction.Begin(Boolean deferredLock)\r\n 在 System.Data.SQLite.SQLiteTransactionBase..ctor(SQLiteConnection connection, Boolean deferredLock)\r\n 在 System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock)\r\n 在 System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel)\r\n 在 System.Data.Common.DbConnection.BeginTransaction(IsolationLevel isolationLevel)\r\n 在 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<BeginTransaction>b__0(DbConnection t, BeginTransactionInterceptionContext c)\r\n 在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n 在 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.BeginTransaction(DbConnection connection, BeginTransactionInterceptionContext interceptionContext)\r\n 在 System.Data.Entity.Core.EntityClient.EntityConnection.<>c__DisplayClass6.<BeginDbTransaction>b__4()\r\n 在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)\r\n 在 System.Data.Entity.Core.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)\r\n --- 內部異常堆棧跟蹤的結尾 ---\r\n 在 System.Data.Entity.Core.EntityClient.EntityConnection.BeginDbTransaction(IsolationLevel isolationLevel)\r\n 在 System.Data.Entity.Core.EntityClient.EntityConnection.BeginTransaction()\r\n 在 System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n 在 System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)\r\n 在 System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClassb.<SaveChangesInternal>b__8()\r\n 在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)\r\n 在 System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)\r\n 在 System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)\r\n 在 System.Data.Entity.Internal.InternalContext.SaveChanges()\r\n 在 System.Data.Entity.Internal.LazyInternalContext.SaveChanges()\r\n 在 System.Data.Entity.DbContext.SaveChanges()\r\n 在 APPAPI.Method.MedToken.UserLoginToken(String account)",

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 應用程序無法啟動,因為應用程序的並行配置不正確,有關詳細信息,請參閱應用程序事件日志,或使用命令行SxsTrace.exe工具 sql server 2016 維護計划執行,提示執行失敗。有關詳細信息,請參閱維護計划和sql server 代理作業歷史記錄日志。 npm : 無法加載文件 D:\nodejs\npm.ps1,因為在此系統上禁止運行腳本。有關詳細信息,請參閱 http://go.microsoft.com/fwlink nginx.service的作業失敗,因為控制進程已退出,錯誤代碼為。 有關詳細信息,請參閱“systemctl狀態nginx.service”和“journalctl-xeu nginx.service”。 babel : 無法加載文件 C:\Users\win\AppData\Roaming\npm\babel.ps1,因為在此系統上禁止運行腳本。有關詳細信息,請參閱 https:/ go.micros 異常詳細信息: System.Data.SqlClient.SqlException: 用戶 'NT AUTHORITY\IUSR' 登錄失敗解決辦法 解決C#項目出現“此項目引用這台計算機上缺少的 NuGet 程序包。使用 NuGet 程序包還原可下載這些程序包。有關詳細信息,請參閱 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props” node_modules/.bin/babel : 無法加載文件 D:\node\node_project\es6\node_modules\.bin\babel.ps1,因為在此系統上禁止運行腳本。有關詳細信息,請參閱 https:/go.microsoft.co m/fwlink/?LinkID=135170 中的 about_Execution_Policies。 在處理向該請求提供服務所需的配置文件時出錯。請檢查下面的特定錯誤詳細信息並適當地修改配置文件 EF 提交提示System.Data.Entity.Infrastructure.DbUpdateException異常的解決方法
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM