Höl*_*lin 4 iis-10 asp.net-core-webapi
我创建了一个 ASP.NET Core 5.0 Web API 项目。我可以在 IIS Express 中执行并运行该应用程序。如果我部署该应用程序,则会收到以下错误:
\nServer Error in Application "application name"\nHTTP Error 500.19 \xe2\x80\x93 Internal Server Error\nHRESULT: 0x8007000d\nDescription of HRESULT\nThe requested page cannot be accessed because the related configuration data for the page is invalid.\nRun Code Online (Sandbox Code Playgroud)\nMS官方支持页面提到了两个原因:
\n\n\n\n出现此问题的原因是 ApplicationHost.config 或 Web.config\n文件包含格式错误或无法识别的 XML 元素。IIS 无法识别未安装模块的 XML 元素。例如,IIS URL 重写模块。
\n解决
\n使用以下方法之一:
\nRun Code Online (Sandbox Code Playgroud)\nDelete the malformed XML element from the ApplicationHost.config or Web.config file.\nCheck the unidentified XML elements, and then install the relevant IIS modules.\n
我的 web.config 附带我的构建/部署过程。对于配置,我使用 appsettings.json。所以我不知道我的 web.config 中是否需要更改以及哪些内容需要更改。有什么建议么?
\n...\\inetpub\\wwwroot\\MyApi\\web.config:
\n<?xml version="1.0" encoding="utf-8"?>\n<configuration>\n <location path="." inheritInChildApplications="false">\n <system.webServer>\n <handlers>\n <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />\n </handlers>\n <aspNetCore processPath="dotnet" arguments=".\\MyApi.dll" stdoutLogEnabled="false" stdoutLogFile=".\\logs\\stdout" hostingModel="inprocess" />\n </system.webServer>\n </location>\n</configuration>\n<!--ProjectGuid: f659debd-cac7-4ce5-b2fe-d1a440a87811-->\nRun Code Online (Sandbox Code Playgroud)\n
您应该安装 .Net 的托管捆绑版本以在服务器上的 IIS 中添加对 .Net core 运行时的支持
所有下载: https: //dotnet.microsoft.com/en-us/download/dotnet/5.0
| 归档时间: |
|
| 查看次数: |
13461 次 |
| 最近记录: |