Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)
—> System.ComponentModel.Win32Exception (2): 系统找不到指定的文件。
这个错误找了很久,原因是自己疏忽大意了,就很奇怪,为什么开发都是正常的,.net API也是正常的,但是数据库不通。原因是版本装错了。生产环境装的dev版本,就导致报错
生产请装express版本。
还需要注意自己的配置文件中的链接字符串是否配置正确
生产一般使用的是appsettings.production.json
而非appsettings.json