预期结果
以下内容:
iis正确地托管了我的应用程序,当我导航到我的应用程序的url(例如:blabla/swagger)时,我看到描述我的应用程序的swagger ui。
问题
以下内容:
当我尝试导航到我的应用程序时,它会说:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
问询处
我在.NETCore2.0中构建了一个应用程序,我可以让它在Kestrel主持的Visual Studio中运行。
不过,我需要将此应用程序部署到不同的服务器上,而且由于Kestrel不支持主机名,所以我需要将其托管在IIS中。当我在Kestrel中运行它时,我能够正确地访问它,并且通过导航到URL/Swagger地址,我能够看到描述应用程序的正确的Swagger页面。
我的应用程序正在
出版
来自visual studio。这意味着在其发布的文件夹中有应用程序所需的所有dll。它是作为一个依赖于框架的应用程序发布的,而不是独立的应用程序,但这应该无关紧要。
如何复制问题
因为有一天我需要把它放在一个Docker容器中的IIS中,所以我试图用powershell脚本把它放在IIS中。我做了什么使它在i is中托管:
New-Website -Name 'myTestApp' -force -Port 8080 -PhysicalPath
'C:\Users\myUser\Desktop\Docker\PublishOutput' -ApplicationPool 'MyAppPoolTest'
在哪里?
C:\users\myuser\desktop\docker\publishoutput
是Visual Studio发布应用程序的已发布文件夹的路径。提前谢谢!
编辑:
这是Visual Studio在发布时生成的web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Friss.CaseApi.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 313d542d-7676-4440-ae1b-22c6071f4309-->
错误页是:
错误2: