I have had a look at this question: Publish WebAPI and MVC projects to same Azure Web Site?
but it doesn not work properly for the "secondary" application.
and from that I learned about virtual directories in Azure web app services ( previously called Azure websites).
I am trying to deploy into the same Azure web apps 2 web applications. Both are ASP.NET 5 applications (they will be MVC 6) under a solution called MyOAuth:
- MyApi: ASP.NET 5 application that should be accessible through myoauth.azurewebsites.com
- MyAuth: ASP.NET 5 application that should be accessible through myoauth.azurewebsites.com/oauth
Solution 'MyOAuth' |-src |- MyApi |- MyAuth
So in the Azure Web App service that I have created (called also MyOAuth), under settings I have the following Virtual Applications and Directories:
/ site\wwwroot Application
/oauth site\wwwroot\oauth Application
The Publish connection from Visual Studio 2015 for both of them are:
- MyApi
Server: myoauth.scm.azurewebsites.net:443 Site Name: MyOAuth User Name: ***** Password: **** Destination URL: http://myoauth.azurewebsites.net
- MyOAuth
Server: myoauth.scm.azurewebsites.net:443 Site Name: MyOAuth/oauth User Name: ***** Password: **** Destination URL: http://myoauth.azurewebsites.net/oauth
These are the Startup configuration for both projects:
Startup.cs for MyApi
//...
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello MyApi app");
});
}
Startup.cs for MyAuth
//...
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.Run(async (context) =>
{
await context.Response.WriteAsync("...And hello MyAuth app");
});
}
After publishing, when I access http://myoauth.azurewebsites.net I get the proper response Hello MyApi app
, but when requesting http://myoauth.azurewebsites.net/oauth I get a server 500 error with text The page cannot be displayed because an internal server error has occurred.
I managed to retrieve the following DetailedError from the Azure LogFiles folder:
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information: Module IIS Web Core Notification BeginRequest Handler Not yet determined Error Code 0x800700b7 Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'httpplatformhandler' Config File \?\D:\home\site\wwwroot\oauth\web.config Requested URL
http://MyOAuth:80/oauth Physical Path D:\home\site\wwwroot\oauth Logon Method Not yet determined Logon User Not yet determinedConfig Source:
<handlers> <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" /> </handlers>
Could anybody advise on this or give me a solution on how to run 2 different ASP.NET 5 applications under the same Azure Web App Service, please? Thank you!