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:
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:
Server: myoauth.scm.azurewebsites.net:443 Site Name: MyOAuth User Name: ***** Password: **** Destination URL: http://myoauth.azurewebsites.net
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!
Its possible following the folder structure outlined here:
https://github.com/aspnet/dnx/issues/928#issuecomment-171617386
THe problem is that I have yet not found tooling that makes it easy to do with vs2015 or VSTeamServices
One of the key things that I had to do to make it work (still did some manual deployments steps - but i found one issue in my setup that could help you also i think). The following will fix the 500.19 error
<handlers>
<remove name="httpplatformhandler" />
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
More information on same topic can be found at: Deploying aspnet5 apps to virtual directories on azure websites
User contributions licensed under CC BY-SA 3.0