Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 add app as IIS application

I'm in the process of migrating some applications from ASP.NET 5 beta7 to RC1. Using HTTPPlatformHandler I am able to run any of these ASP.NET 5 RC1 applications as the root of an IIS site. But they will not run as a subdir (right-click 'add application') of the site. The full response shows:

HTTP/1.1 404 Not Found
Content-Length: 0
Server: Kestrel
X-Powered-By: ASP.NET
Date: Tue, 24 Nov 2015 14:59:04 GMT

It isn't a permissions issue, as the route is served successfully when the app is the root of the site and using the same app pool.

The app pool is configured for 'no managed code' and integrated pipeline.

The web.config for the root application looks like this:

<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
  </system.webServer>
</configuration>

For the sub application I've had to remove the httpplatformhandler handler to avoid the error "Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'httpplatformhandler'".

Now that we have to use kestrel/httpplatformhandler, is it possible to run as an application under a site?

like image 803
jltrem Avatar asked Dec 25 '22 12:12

jltrem


1 Answers

This problem started with beta8 and is still an open issue in RC1. See ASP.NET IIS Integration issue #14. "That fix is coming." says @davidfowl. "This is a workaround until the fix is available. We're working with the httpPlatformHandler team to fix bugs found in beta8 and rc1."

The workaround is to map the IIS app path in Startup.Configure like this:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.Map("/MyAppPath", (myAppPath) => this.ConfigureMyAppPath(myAppPath, env));
}

public void ConfigureMyAppPath(IApplicationBuilder app, IHostingEnvironment env)
{
    // the actual Configure code
}
like image 54
jltrem Avatar answered Dec 27 '22 01:12

jltrem