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.

1
  • 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. Commented Mar 16, 2016 at 11:25

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks, that's a step in the right direction. I can write app.Map("/Child", appl => ...); and it executes the delegate. But I still don't see a way how to broker the request to the child application.
Wouldn't a context.Response.Redirect("yourpathhere") work?
I tried it. But then I cannot run the ASP.NET 4.5 application as child application, but need a separate web site on a separate port. Then I also don't need the /Child path, because I could use the separate URL directly. I thought there is a direct way to get IIS child applications to work as before, but this seems not to be true.
Well, let's not jump to conclusions. I might be wrong. Could you switch on the logging in httpPlatformHandler? In the web.config in the wwwroot: stdoutLogEnabled="true" stdoutLogFile="..\logs\httpplatform-stdout"
Ok. I have enabled it and a log is created, but it does not show anything "special", when I want to access the main application in the browser... and when I want to access "/Child1", it's just saying nothing in the case of a client application - only the favicon is requested and returned.
|
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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.