Hosting Multiple Applications with ASP.NET aka Sweat Equity

I’ve just finished writing my first proper ASP.NET web page and just been through a mental-workout trying to get more than one of them hosting at the same time on Somee. By that, what I mean is that on my host, I want to have a directory structure like this:

With each sub-directory having its own files and resources so that I could go to URLs like this:

  • http://www.asp2015test.somee.com and,
  • http://www.asp2015test.somee.com/AnotherAmazingWebApp/

Should be easy, right?

My first idea was just to copy all my published files into each directory and try that, but it-does-not-work!

The problem was that I could store one web application in the root directory (and have it work), but when I tried doing the same for another application in a sub-directory, suddenly it all went awry. There were a host of different errors, but the gist was that I could access my Default.aspx file, but all resources, including the assemblies, were inaccessible. I got a little closer by copying the dll file in a bin directory to the root, but all my graphics still remained unobtainable. It was as if when looking for required files, it would go to the root folder instead of the sub-directory. Sigh.

My Google inspired path took me to web.config files, default files, url mapping, transformations and more, and honestly, eventually the answer was ridiculously easy. If you are in the same position, this is what you need to do:

  • In the Applications section of your control panel, add your sub-directory as an application and click OK!

I can’t believe how easy it is! Below are some images of what it looks like on Somee in case you use that company¬†but I bet it is very similar on other hosts or if you have access to IIS directly.

Somee Applications Menu Item

Choosing the Applications menu item.

  1. Choose Applications. You can see above where that lies on Somee.
Showing how applications are selected.

Adding an application.

  1. Select your directory (which you should have already created) and click on Convert folder to Application. Give it a short while and it should be fine. Note: don’t forget to copy your files in there, too!

Hope that helps.

twittergoogle_plusredditpinteresttumblrmail

Written by Stephen Moon
email: stephen at logicalmoon.com
www: https://www.logicalmoon.com


Leave a Reply

Your email address will not be published. Required fields are marked *