[英]ASP.NET Core 5 Web API with Entity Framework works when running in IDE but not when published to folder and installed in IIS
I have such a frustrating issue.我有这样一个令人沮丧的问题。 I have authored an ASP.NET Core 5 Web API with Entity Framework Core.
我已经使用 Entity Framework Core 编写了 ASP.NET Core 5 Web API。 This runs perfectly on my dev machine and if I copy my project to another machine I can simply update the connection string and it runs there as well.
这在我的开发机器上完美运行,如果我将项目复制到另一台机器,我可以简单地更新连接字符串,它也可以在那里运行。
Whenever I publish the project and attempt to access it via IIS.每当我发布项目并尝试通过 IIS 访问它时。 I get the following error.
我收到以下错误。
Category: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
类别:Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
EventId: 2事件编号:2
SpanId: f97ede8e15417a59跨度 ID:f97ede8e15417a59
TraceId: 7ebb4da21f77111ec887913667671c80TraceId:7ebb4da21f77111ec887913667671c80
ParentId: 0000000000000000父 ID:0000000000000000
RequestId: 80000017-0002-fe00-b63f-84710c7967bb请求ID:80000017-0002-fe00-b63f-84710c7967bb
RequestPath: /api/v1/users/auth请求路径:/api/v1/users/auth
Connection ID "18302628895834243094", Request ID "80000017-0002-fe00-b63f-84710c7967bb": An unhandled exception was thrown by the application.
连接 ID “18302628895834243094”,请求 ID “80000017-0002-fe00-b63f-84710c7967bb”:应用程序引发了未处理的异常。
Exception:
例外:
System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClientSystem.PlatformNotSupportedException:Strings.PlatformNotSupported_DataSqlClient
at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)
在 Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(字符串连接字符串)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)在 Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory)在 System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func
2 valueFactory)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()在 Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()
This is my first time publishing a .net core app to IIS but I have followed a lot of guidance from the community and my swagger home page loads so this is definitely about SQL. This is my first time publishing a .net core app to IIS but I have followed a lot of guidance from the community and my swagger home page loads so this is definitely about SQL.
Below is my publishing profile.以下是我的发布资料。 Can't figure out what I am doing wrong.
无法弄清楚我做错了什么。
Thanks for the help.谢谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.