ASP.Net Core: LAUNCHER_PATH and LAUNCHER_ARGS in web.config


In github, IISSample cleared my confusion about processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%".

In web.config, following lines exist:

<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" module="AspNetCoreModule" resourceType="unspecified"/>
</handlers>

<!-- 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"/>

</system.webServer>
Now read the comments and understand it what would be used when.

<!-- 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"/>

To have the project run and debuggable locally under VS2015 via IISExpress, web.config needs 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"/>

To configure publish-iis to do automatic replacement, add this snippet to your project.json.

  "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"

Hope this will help you to understand these lines in web.config


Comments

Popular posts from this blog

Data Bound Controls in ASP.Net - Part 4 (FormView and DetailsView controls)

ASP.net: HttpHandlers

The Clickjacking attack and X-Frame-Options