There are breaking changes in ASP.NET 5 RC2 release:
dnvm
and dnu
command line, they are replaced by dotnet
I am trying to deploy the files generated by dotnet publish
. The files structure is different from RC1. I see the following error in the Event Viewer:
Failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%', Error Code = '0x80070002'.
These environment variables are mentioned in web.config
, which is taken from the official rc1-to-rc2 document.
<configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/> </system.webServer> </configuration>
What are the correct values for %LAUNCHER_PATH%
and %LAUNCHER_ARGS%
? These values are not mentioned in their github publish document.
The web. config file has also been replaced in ASP.NET Core. Configuration itself can now be configured, as part of the application startup procedure described in Startup.
config file location. In order to set up the ASP.NET Core Module correctly, the web. config file must be present at the content root path (typically the app base path) of the deployed app.
From github IISSample (thank you @Pawel and Luke), here are the value possibilities:
<!-- This set of attributes are used for launching the sample using IISExpress via Visual Studio tooling --> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/> <!-- This set of attributes are used for launching the sample for full CLR (net451) without Visual Studio tooling --> <aspNetCore processPath=".\IISSample.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/> <!-- This set of attributes are used for launching the sample for Core CLR (netcoreapp1.0) without Visual Studio tooling --> <aspNetCore processPath="dotnet" arguments=".\IISSample.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
After several hours dealing with them, I found there are two web.configs that we need to deal with: src\ProjectName\wwwroot\web.config
and src\ProjectName\web.config
. If you dont have the latter, VS2015 publish will generate one for you with %LAUNCHER_PATH%
and %LAUNCHER_ARGS%
by default.
To have the project run and debuggable locally under VS2015 via IISExpress, both web.config need to have the default value below. Replacing LAUNCHER_PATH and LAUNCHER_ARGS to something else causes VS2015 to hang indefinitely.
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
However, upon deploying to IIS (I am using 8.5 on WinServer 2012 R2), the value on src\ProjectName\web.config
must be replaced with the following. If configured, the dotnet publish-iis
command suppose to do the replacement for you (see below).
<aspNetCore processPath="dotnet" arguments=".\ProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
If you are migrating from RC1, change the http bound directory as well to Project root folder, not wwwroot. Example: from C:\inetpub\ProjectName\wwwroot
to C:\inetpub\ProjectName
.
To configure publish-iis
to do automatic replacement, add this snippet to your project.json: (Thank you @Pawel)
"tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": { "version": "1.0.0-preview1-final" } }, "scripts": { "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" }
The IISIntegration tool segment converts these Launcher variables to the appropriate deployment values. Without it, you will get the following error:
No executable found matching command "dotnet-publish-iis"
I am using RC2 Toolkit Preview 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With