1
votes

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.

2
It would be easier to host the ASP.NET 4.5 at the same level and then utilize URL Rewrite to map it to the desired location. I think that should avoid the side by side issue. - Lex Li

2 Answers

0
votes

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

0
votes

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>