Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Support for Azure web site with multiple applications #928

Closed
hfjallemark opened this issue Nov 24, 2014 · 25 comments
Closed

Support for Azure web site with multiple applications #928

hfjallemark opened this issue Nov 24, 2014 · 25 comments
Milestone

Comments

@hfjallemark
Copy link

There seems to be no way to publish to and/or run multiple applications within one Azure web site. The reason seems to be the folder layout of approot; only the approot for one application can exist (multiple wwwroots seem to work fine).

I am not sure if the issue is within Azure or KRuntime, but from what I can see it is the kpm pack that outputs the folder structure.

@davidfowl
Copy link
Member

What does this even mean?

@hfjallemark
Copy link
Author

That the directory layout (approot and wwwroot) seems to be incompatible with the way Azure Web Sites works with multiple applications.

More info here:

@davidfowl
Copy link
Member

It isn't. The approot lives as a sibling to the wwwroot.

@hfjallemark
Copy link
Author

So what directory structure should be published? When publishing using Visual Studio 2015 it replaces the approot of the first published application when publishing the second application.

Is this a problem with VS or MSBuild?

@davidfowl
Copy link
Member

How did you do this before ASP.NET 5? Can you walk me through that process?

@hfjallemark
Copy link
Author

Before ASP.NET 5 it was done just like described in this article. This worked when everything was deployed within one directory (content files and bin folder together).

Now they are deployed into two separate folders. The content files (wwwroot) ends up where they should (in the subfolder defined in the publish settings) but the approot ends up in the root, hence being replaced every time a new application is published.

@tugberkugurlu
Copy link
Contributor

Doesn't this work? http://blogs.msdn.com/b/tomholl/archive/2014/09/22/deploying-multiple-virtual-directories-to-a-single-azure-website.aspx

On 25 Nov 2014, at 09:51, hfjallemark [email protected] wrote:

Before ASP.NET 5 it was done just like described in this article. This worked when everything was deployed within one directory (content files and bin folder together).

Now they are deployed into two separate folders. The content files (wwwroot) ends up where they should (in the subfolder defined in the publish settings) but the approot ends up in the root, hence being replaced every time a new application is published.


Reply to this email directly or view it on GitHub.

@davidfowl
Copy link
Member

I'm pretty sure it can be made to work but there are differences that need to be considered. We'll take a look at this and get back to you

@tugberkugurlu
Copy link
Contributor

Sorry, it seems that you already indicated that 😄

On 25 Nov 2014, at 09:51, hfjallemark [email protected] wrote:

Before ASP.NET 5 it was done just like described in this article. This worked when everything was deployed within one directory (content files and bin folder together).

Now they are deployed into two separate folders. The content files (wwwroot) ends up where they should (in the subfolder defined in the publish settings) but the approot ends up in the root, hence being replaced every time a new application is published.


Reply to this email directly or view it on GitHub.

@hfjallemark
Copy link
Author

Thanks. Let me know if I can assist in any way.

@hfjallemark
Copy link
Author

Any updates on this?

@rubenprins
Copy link

@davidfowl, Any updates on this? Not being able to publish multiple applications to a single website by default (IIS or Azure) is pretty much a deal breaker for us.

There are undoubtedly many possible workarounds/hacks for this, but when you've got to manage 200+ applications under just a couple of websites -- like we do (mostly small-ish applications) -- this will get annoying really soon. And a dedicated website for each application is a no-go area. (Not that we're going to "upgrade" these applications to v5 any time soon (or at all) -- that would be a Herculaneum effort indeed.)

(This has never been a problem for ASP.NET v1-4 because it bundles the application from the WEB application's root folder, rather than insisting on creating a hierarchy next to it. I understand the basic reasoning behind it, but it simply doesn't work for subapplications.)

@davidfowl
Copy link
Member

No updates on this as yet. We're still busy making the fundamentals solid. We'll need to have a discussion on the possible options here.

@glennc glennc added this to the 1.0.0 backlog milestone Jul 17, 2015
@muratg muratg modified the milestones: 1.0.0 backlog, Backlog Dec 11, 2015
@pksorensen
Copy link

@davidfowl
Copy link
Member

Everything here is workable btw with the platform handler. You can host N applications by swapping the layout as follows:

/someroot/
    /app1/web.config  <- moved to the root
             /approot/code here
             /wwwroot/*.*  <- static files are here
    /app2/web.config
    ..
    /appN/web.config

The layout is changing to something more flat in the RC2 timeframe but it's the same idea:

   /someroot/
           /app1/web.config
                    /wwwroot/*.* <- static files
                   *.dll

As part of moving web.config up one level, you also need to change the executable entry to point to the right relative path but it should be trivial to do.

@pksorensen
Copy link

Ye. the hardest thing about it now is the tooling. The default tooling in vs15 currently generates the output I showed. I assume these will align over time.

I will give your layout a try manual and confirm that it works with two apps.

Might actually be able to get default tooling to work also now that I think about it. I will give a update with a few more experiments when off the clock.

@pksorensen
Copy link

I actually believed I got it working.

https://twitter.com/pksorensen/status/687675626690625536

but then I could not reproduce it and found out that the only reason app1 and app2 worked was because app0 failed.

       <EventData>
            <Data>3005</Data>
            <Data>An unhandled exception has occurred.</Data>
            <Data>1/14/2016 4:28:22 PM</Data>
            <Data>1/14/2016 4:28:22 PM</Data>
            <Data>9e154d9858c44a6181df56b015846c1c</Data>
            <Data>1</Data>
            <Data>1</Data>
            <Data>0</Data>
            <Data>/LM/W3SVC/1711399963/ROOT-4-130972614840190318</Data>
            <Data></Data>
            <Data>/</Data>
            <Data>D:\home\site\wwwroot\app0\</Data>
            <Data>RD0003FF1A2328</Data>
            <Data></Data>
            <Data>1488</Data>
            <Data>w3wp.exe</Data>
            <Data>IIS APPPOOL\wildlifedemo</Data>
            <Data>HttpException</Data>
            <Data>Server cannot access application directory 'D:\home\site\wwwroot\app0\'. The directory does not exist or is not accessible because of security settings.
   at System.Web.HttpRuntime.EnsureAccessToApplicationDirectory()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

</Data>
            <Data>http://wildlifedemo.azurewebsites.net/</Data>
            <Data>/</Data>
            <Data>77.75.160.102</Data>
            <Data></Data>
            <Data>False</Data>
            <Data></Data>
            <Data>IIS APPPOOL\wildlifedemo</Data>
            <Data>15</Data>
            <Data>IIS APPPOOL\wildlifedemo</Data>
            <Data>False</Data>
            <Data>   at System.Web.HttpRuntime.EnsureAccessToApplicationDirectory()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)
</Data>
        </EventData>

I killed the w3wp process and app0 started working but then app1 and app2 keeps saying The page cannot be displayed because an internal server error has occurred. and I havent been able to get it out in the logs why.

So, i followed your folder setup and could not get it working with a simple hello world app.

@pksorensen
Copy link

detailed logging indicated dublicate of platformhandler registration.
Got things working with

 <handlers>
      <remove name="httpplatformhandler" />
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>

@iberodev
Copy link

Poul, did you get it working? what web.conf is that where you remove the httpplatformhandler?

Say I have 2 projects that want to host under the same website.
In Azure Virtual Applications and directories

/            site\wwwroot                Application
/app2    site\wwwroot\app2       Application

As you mentioned the hierarchy created by default when deployed in Azure is:

wwwroot
  |--web.conf (this is the web.conf for the main project, the root one)
  |--approot
  |--app2
       |--web.conf (this is the web.conf for the app2, the virtual directory one)

Where do I have to remove the httpplatformhandler (if needed)?
Do I have to create another virtual directory for the main project app1?
I am a bit confused with this :-)

UPDATE: I actually found your answer at http://stackoverflow.com/a/34799414/2948212
Thank you

@pksorensen
Copy link

I tried to include most information at the answers here:
http://stackoverflow.com/questions/34781561/run-two-different-asp-net-5-applications-under-the-same-azure-web-app/34791708#34791708
and here:
http://stackoverflow.com/questions/34784391/deploying-aspnet5-apps-to-virtual-directories-on-azure-websites

Could you read those first and then ask again if its still unclear - and theres nothing wrong with asking again, just want to make sure that you seen the content there first.

@ttugates
Copy link

ttugates commented Nov 12, 2017

I understand this is closed.. But as of Nov 17', is the only way too accomplish publishing multiple .Net Core apps to Azure Virtual Directories entail using the solution @pksorensen and @davidfowl give. And not using VS20017's Publish tooling?

@davidfowl
Copy link
Member

I believe the logic in the original article will work now since the layout is much closer to what the original model had (single root folder)

@pksorensen
Copy link

I have not checked if anything new or better is around, what I did back then still works for me and i still virtual applications by dropping dotnet core apps in separate folders.

@davidfowl
Copy link
Member

The major difference is that no longer have folders that are siblings to the wwwroot folder.

@ttugates
Copy link

Thanks for super fast responses to both of you.. I started by trying the original article and received an error on publish. Don't recall details.. But found this.. After work tonight I will try again and let you know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants