【发布时间】:2019-05-12 08:08:45
【问题描述】:
我在 asp.net core 2.0 中创建了一个简单的 web api,它使用 localdb 作为后备数据存储。它在调试中完全按预期工作 - 我能够从邮递员(或浏览器)发送请求并逐步执行我的代码。这是我的连接字符串:
"Server=(localdb)\\MSSQLLocalDB;Database=UniversityDatabase;Trusted_Connection=True;MultipleActiveResultSets=true"
我现在希望它持续运行,以便我可以从 Xamarin.Forms 项目中使用它,因此我尝试使用 Visual Studio 向导发布 Web 应用程序。
1.
2.
UniversityApi 然后出现在默认网站下的 IIS 中,但不是作为应用程序。我选择“转换为应用程序”,这会显示这个对话框:
3.
NetCoreApps 应用程序池不使用托管代码。
错误:
{
"error": [
"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: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.\r\n)"
]}
该错误似乎描述了连接到我的 Sql Server 实例的问题,这很奇怪,因为它在 VS 中调试时运行良好。有什么想法吗?
【问题讨论】:
标签: sql-server iis asp.net-web-api asp.net-core