Search code examples
asp.netasp.net-mvcazuresubdomainvirtual-directory

Azure multiple websites, subdomains and virtual directories


I have a front end application and an admin application in a dedicated windows server on IIS. The admin has an images virtual directory pointing to the front end images directory so that any images uploaded through the admin uploads to the front end directory. Also the admin is a sub domain of the front end website. I am trying to replicate this structure in Azure.

So far what I've tried:

  1. Created two different web apps and mapped the external domains say, www.contoso.com and admin.contoso.com with no problem. But if I need to create a virtual directory in the admin web app, it doesn't allow me to reference anything outside the site\wwwroot folder of the admin web app.

  2. Created two directories in the same web app but cant find a way to map www.contoso.com and admin.contoso.com to two different directories in the same web app.

  3. Uploaded the front end to the site\wwwroot and created a sub directory called admin and mapped www.contoso.com and admin.contoso.com to the same web app and used url rewriting to point the admin sub directory to admin.contoso.com. But still can't find a proper way to add a virtual directory in the admin to point to the front end.

I am using the new portal and the applications use ASP.NET MVC, .NET 4.5 by the way.

Can anyone please point me in the right direction of how to manage and configure multiple websites with subdomains and virtual directories?


Solution

  • I've used the third approach from my question where I created a sub directory for the admin. I would still like to know how this can be done using other approaches.

    So I had created a virtual application for the admin already which is mapped to the subdomain. I was trying to add a virtual directory for admin/content/images/frontend to point to the front end site\wwwroot\content\images. I was doing this in one single line of virtual directory setting which was complaining that the path was invalid. So I had to create a virtual directory for each admin/content mapped to site\wwwroot\admin\content, admin/content/images mapped to site\wwwroot\admin\content\images and then finally admin/content/images/frontend mapped to site\wwwroot\content\images which worked.