On my hosting server I want to achieve the following arhitecture of main site and subdomains:
www.site.com
subdomain1.site.com
subdomain2.site.com
All three domain have some common resources: scripts, css files, images and custom error files to present errors like 404, 503 in a creative intriguing and most entertaining way.
I have organized folders on my hosting server into this structure
www-main
www-subdomain1
www-subdomain2
shared-css
shared-errors
I have setup each subdomain as an asp.net applicatin which resides in its physical folder.
To access common shared resources I have created virtual folders for each subdomain that point to the sam physical folders.
virtual folder shared-css in subdomain1 points to shared-css physical folder
virtual folder shared-css in subdomain2 points to shared-css physical folder
This works ok. But not for folder containing error files. I have configured my web.config and files according to http://benfoster.io/blog/aspnet-mvc-custom-error-pages
The problem is that it does not work for subdomains. If I configure virtual folder as asp.net application it complains it cannot load assemblies for the application for which this folder was created. On the other hand if I configure it as ASp folder it simply does not work.
This same concept works if site is not divided into subdomains but into subfolders instead of subdomains.
Does anybody has a working solution for this problem?
Not suggestions, I have tried many things, anything I could think of.
Related
I'm creating multiple small ASP.Net Web forms applications i want on my host each project of those to run in different subfolders for the root directory of my host. When i puplish each project to different subfolders of the root directory all of them dont work. The only one that works is the one at the root directory. I think this issue is related to Web.Config. I want to ask is there a way to run each application of those in different subfolder without creating other websites ??
IIS
I have been doing this a lot for testing purpose before final deploy. I just host the new application in the virtual directory of the the existing website that we own.
for eg:- www.example.com is our site
and we have a application named xyz then url for new application will be : www.example.com/xyz
You have to add a virtual directory in the root of the IIS website and turn it into an application by right-clicking on it in the IIS management console.
Or simply you can put the website in your root website (as in your case) and then in the IIS management console convert that folder to application.
Create and Configure Virtual Directories
Setting Virtual Directories as Applications in IIS
I'm having problems with a site using a virtual directory to share images between three load balanced web servers.
The three web servers all have an asp.net website installed using IIS 7.5 and a virtual directory pointing to the same shared folder. There is no problem reading the images.
The problem is that the windows service that is downloading images and writing to the shared folder gets the exception, "The process cannot access the file 'D:\WebShare\images\440.jpg' because it is being used by another process".
Is there any way to "force" an overwrite? Or should I rethink my solution? It must be a very common scenario that multiple web servers share a folder and some other process updates the files in that folder but I can't find a solution to my problem.
So I've solved the problem. I have another service running on each server copying the images to a local folder instead of each server reading the images from the same shared folder.
My guess is that the problem has something to do with the fact that an IIS website was reading from a shared folder on another server. The only difference now is that the website is reading from a local folder. I still have a windows service overwriting images in that folder.
I have two ASP.NET web forms application and I need to run them independently of each other. But for logistical reason of maintenance I prefer to have one as a Sub-folder of the other. Example:
c:\inetpub\wwwroot\MyAppl1
c:\inetpub\wwwroot\MyAppl1\MyAppl2
Each application has its own Form Authentication (different name log in pages)
First I create the MyAppl1 as web site and MyAppl2 as virtual directory. But then running a page in the MyAppl2 gives error:
The virtual path '/Site.Master' maps to another application, which is not allowed.
The above Site.Master is in c:\inetpub\wwwroot\MyAppl1\MyAppl2
Now I am thinking that maybe virtual directory was not the best approach. Can I create MyAppl2 in IIS as a separate Site pointing to a physical directory which is in sub-directory of another site?
I am working on multiple websites in asp.net mvc. Some websites are top level domains and some are subdomain but all these websites are hosted on same server.
www.foo.com
subfoo.foo.com
www.abc.com
a.abc.com
I want all these websites should access same directory for save and retrieve some files in this way i can manage files efficiently.
www.foo.com/assets
subfoo.foo.com/assets
Currently every website is handling data its own wwwroot directory so when i need these files on different website then i have to do lot of work for retrieval.
For this purpose i have created folder out side the websites directory and point out as virtual directory in one websites. I tried to repeat same process for other websites but can 't do this because hosting server does not permit me to point out virtual directory on same folder.
So my question is this limitation of IIS. Is there any other technique to do this task in better way?
Virtual directory is the only way I know of to do what you ask. It sounds odd that you have a limitation of one virtual directory pointing to the same folder, maybe you need a new host.
EDIT: Just realized how old this question was. Well maybe this will still be of help to someone.....
We run IIS with Approx 5 different web sites. These websites each have their own root directory. We don't typically access things from the other websites, but if we were to do this I would think we would setup another directory on the server for those files to live in. This is assuming that the files you are trying to access are static files.
To Clarify...
C:\inetpub\WebSite1Root
C:\inetpub\WebSite2Root
C:\inetpub\WebSite3Root
Then place the static files in
C:\StaticFiles
So to access those static files Website1 (or 2 or 3) would simply look in that shared directory.
I'm not sure if this helps but I would be happy to answer questions if you have any.
Currently working on an internationalization project. One of the requirements is to take static files published from a content management system and serve the correct language version based on the locale. Unfortunately the published files are .aspx and include references to master pages and potentially other controls.
If the pages are inside the web root, this is pretty easy. I just have something in global Application_BeginRequest that takes a request for /abc.aspx and rewrites it to /content/[locale]/abc.aspx.
For ease of deployment and a couple of other reasons, I would really like these files to be outside the web root. e.g. site is in "D:\www_root\site\" and content is in "D:\content".
Is there a way to achieve this?
You can create a virtual directory in IIS that points to d:\content.
A virtual directory is a directory name (also referred to as path) that you specify in IIS and map to a physical directory on a local or remote server. The directory name then becomes part of the application's URL, and users can request the URL from a browser to access content in the physical directory, such as a Web page or a list of additional directories and files.