ASP.Net Core 1.0 RC2 : What are LAUNCHER_PATH and LAUNCHER_ARGS mentioned in web.config?
Asked Answered
C

4

48

There are breaking changes in ASP.NET 5 RC2 release:

  • It is rebranded to ASP.NET Core 1.0 (ASP.NET 5 is dead)
  • Good bye dnvm and dnu command line, they are replaced by dotnet
  • Various necessary code changes

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.

Chari answered 26/5, 2016 at 14:5 Comment(0)
C
56

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.

Chari answered 27/5, 2016 at 17:9 Comment(4)
I don't think we need 2 web.config for RC2. I believe the one in wwwroot is useless now.Overview
@Overview not really. the project\wwwroot\web.config is used to generate project\web.config . If you configure your project.json as above, it will use your project\wwwroot\web.config as a template.Chari
Ah... you can try it yourself. It works correctly without having web.config in wwwroot. And yes, I use the same scripts in project.json. In fact, it is how new template does when you upgrade to 1.0.0-preview1-002702Overview
+1 for this "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%". I was migrating from RC2 to 1.0 final and IIS deploy was not changing the web.configExterritorial
B
10

The %LAUNCHER_PATH% and %LAUNCHER_ARGS% are used by VS. publish-iis tool (if configured) will override them when you publish your application.

Brunette answered 27/5, 2016 at 4:38 Comment(2)
Where do I find publish-iis tool? Is it possible for me to call it via command line somewhere?Streamline
The tool is brought to you by specifying a reference in the tools section in your poject.json and dotnet restoreing your project. Wile you can run the tool from command line the typical usage is to configure it as a post publish script. See my post for more details: blog.3d-logic.com/2016/06/08/…Brunette
T
10

This is part of web.config in VS:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
    stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
    forwardWindowsAuthToken="false"/>

And this is on the server after publishing:

<aspNetCore processPath="dotnet" arguments=".\AppName.dll" 
    stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" 
    forwardWindowsAuthToken="false" />

In this example %LAUNCHER_PATH% was replaced by dotnet, and %LAUNCHER_ARGS% by application name with .dll extension

Tsui answered 27/5, 2016 at 11:57 Comment(2)
why forwardWindowsAuthToken="false" ? Seems necessary to run on IIS Express with processPath="dotnet"Dempsey
So if the app is running under local IIS, then how do these values get corrected? There is no "publish" when running the application directly from IIS.Languishment
B
1

Thanks for the help guys, I was using a template (https://github.com/MarkPieszak/aspnetcore-angular2-universal) and the command

dotnet publish

made a folder under

bin/Debug/netcoreapp1.1/publish

Setting this path as the root directory of the site made it work!

Burnley answered 16/5, 2017 at 19:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.