How to Nest Applications under Parent App inside IIS


How to Nest Applications under Parent App inside IIS and Under One Domain.

    When you host an ASP.net Application inside the IIS Web Server, sometimes you will be constrained to host only one application per one domain and eventually you would like to host multiple application under one domain. This is helpful for small businesses that do not have a lot of money to pay for several static IP Addresses. Definitely not convenient for teams of developers who would want to start upgrading the legacy system to a well-secured platform.

Problems:

    Go Daddy or Cloudflare domains does not allow customers or domain owners to map or point the domain name to the Server IP's through different ports, which means, you can only point one domain to one Server IP Address. This can be costly to small Businesses to keep on provisioning multiple Servers to be able to host multiple applications that are crucial to Business Operations.

Solution:
  1. Create a website inside IIS
  2. Host your Parent Web Application on the Website folder created in step 1
  3. Then, right click on the parent Web App created in step 2
  4. Choose, "Add Application"
  5. Then, give the Child Application an Alias name (For example, you will access the child app like this; www.{YourParentAppDomain}.com/{ChildAppAliasName}/{WhateverUrlYouWant}) 
  6. Assign an Application Pool to the Child Web App and Configure the Application Pool privileges it needs
  7. Recycle the Application Pool and restart the Child Application or the Server (IIS Server, not the computer)
  8. Try to access the Child Application through the Parent Domain Name e.g (www.{YourParentAppDomain}.com/{ChildAppAliasName}/{WhateverUrlYouWant}) if you have an error get the error description and the line number where the error happened. Remember, to hide the errors in production.
  9. Then, open up the Web.config file and wrap the Tree Node of the code where the error happens using this code:
    location path="." inheritInChildApplications="false">
  10. //Your code that is causing an error will be inside this
  11. location>

Then test the Child Application through the Parent Application Again. If the error happens again, keep on wrapping the latest error in the location code, this will tell the Parent Application that, when a child app runs, the following code should not execute.

Servers
published
v.0.01




For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]