我有一个工作web.config,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Example.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
但不知何故Visual Studio正在将我的web.config更新为:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这可以通过发布菜单在Visual Studio中工作(并且一旦部署到azure web应用程序就可以工作).但是,如果我使用dotnet发布等dotnet CLI,它就不起作用,因为它保持带有变量的web.config:%LAUNCHER_PATH%和%LAUNCHER_ARGS%而不是我想要的:dotnet和.\ Example.dll.
注意:在使用dotnet restore和dotnet …