ASP.NET 4.5 application inside of ASP.NET Core app in IIS

1

We have an ASP.NET Core 1.0 RC1 application running against dnx-clr-win-x86.1.0.0-rc1-update1 and hosted in IIS as separate web site. This one works fine.

Now we want to add a "child" application to this web application, so both are running on the same port, but the child application should be available in a sub-path /Child. The child application is a normal ASP.NET 4.5 Web API app.

This setup worked fine before ASP.NET 5, when the main application was also a ASP.NET 4.5 application. But it unfortunately fails with ASP.NET 5. When we try to access the child application in the browser, we get a:

HTTP Error 502.3 - Bad Gateway
There was a connection error while trying to route the request.

Module          httpPlatformHandler
Notification    ExecuteRequestHandler
Handler         httpplatformhandler
Error Code      0x80070002

Has this to do with the new way of hosting ASP.NET 5 applications by using the httpPlatformHandler? As said: it works well for the main ASP.NET 5 application, just not for the child ASP.NET 4.5 application. HttpPlatformHandler 1.2 is installed.

asp.net
.net
iis
asp.net-core
asked on Stack Overflow Mar 16, 2016 by Matthias

2 Answers

0

Yes, the httpPlatformHandler changes this behaviour.

I think you need to branche the HTTP request by using the "Map" extension method on the IApplicationBuilder. So for instance this piece of code in the "Configure" method of the "Startup" class:

            app.MapWhen(context =>
        {
            return context.Request.Query.ContainsKey("branch");
        }, HandleBranch);

And HandleBranch could then look like:

        private void HandleBranch(IApplicationBuilder app)
    {
        app.Run(async (context) =>
        {
            await context.Response.WriteAsync("Branch used.");
        });
    }

This then handles all querystrings with the word "branch" in it. You could catch subpath "/Child".

answered on Stack Overflow Mar 16, 2016 by Danny van der Kraan
0

Make sure your ASP.Net 4.5 app uses separate pool and that this pool is managed. Open web.config of ASP.Net Core app and check name of "AspNetCoreModule", by default it's "aspNetCore"

Open web.config in ASP.Net 4.5 app and add the following into system.Webserver=>handlers section

<configuration>
    <system.webServer>
        <handlers>
            <remove name="aspNetCore"/>
            <!--Your other handlers -->
       </handlers>
    </system.webServer>
</configuration>
answered on Stack Overflow Apr 5, 2018 by Vitaly

User contributions licensed under CC BY-SA 3.0