【EF core】Microsoft.Data.Sqlite.SqliteException:“SQLite Error 14: 'unable to open database file'.”

数据库配置错误。

将相对地址修改为绝对地址就可以了。

提示错误

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings     >
    <add name="ConnectionString"
             connectionString="Data Source=.\Repositories\Database.db; "
             providerName="Microsoft.EntityFrameworkCore.Sqlite"
             />
  </connectionStrings>
</configuration>

 

 

修改后

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings     >
    <add name="ConnectionString"
             connectionString="Data Source=D:\程序开发\观察者\LYFWPFUI\LYFWPFUI\Repositories\Database.db; "
             providerName="Microsoft.EntityFrameworkCore.Sqlite"
             />


  </connectionStrings>


</configuration>

就不提示错误了

 

posted @ 2022-11-14 23:25  小林野夫  阅读(757)  评论(0编辑  收藏  举报
原文链接:https://www.cnblogs.com/cdaniu/