ASP.NET Core/5如何与IIS Express集成?
我正在排除故障原因IIS Express
在移动我的ASP.NET
核心项目后无法找到我的web.config
。ASP.NET Core/5如何与IIS Express集成?
(HTTP错误500.19 - 无法读取配置文件 - web.config文件)
我的研究发现,大多数人都改变对ApplicationHost.config文件。然而,当我打开我的ApplicationHost.config文件我只看到了什么看起来是默认项(的WebSite1是不是我的项目名称):
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
我也明白,launchSettings.json文件有IIS Express
使用的选项。举例来说,我已经改变了我localhost port
到4444
在我launchSettings.json
文件:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4444",
"sslPort": 0
}
},
之前,我提出我的项目,一切工作。另外,如果我选择在Visual Studio
(Kestrel,我认为)中使用“web”运行我的项目,即使在移动之后,它也可以正常工作。
所以我的问题是如何和/或我的ASP.NET
核心应用程序设置为IIS Express
的具体设置?我特别感兴趣的是如何找到并更改我的项目的物理路径,以便IIS Express
可以找到我的web.config
。
移动项目时,请确保复制根文件夹,以便包含文件夹内的所有文件。这听起来像你刚刚复制了不包含所有内容的“src”文件夹。
如果您复制根文件夹并打开项目,它将运行良好。正如Lex Li上面提到的,有一个名为.vs的隐藏文件夹,其中包含一个带有applicationhost.config的配置文件夹。
谢谢乔和Lex! hidden.vs文件夹是我理解的关键。路径设置保持解决方案的关键。 – James
您是否将.vs隐藏文件夹移动到您的解决方案文件夹中? IIS Express配置文件位于该隐藏文件夹中。 –