Why does the IIS virtual directory work with http://localhost but not http://computername


I have been given the task of adding functionality to an existing IIS 6.0 website. To do it, I have built an ASP.NET MVC application. It works fine when deployed as it's own site, but doesn't seem to work when I try to deploy it as a virtual directory on the actual site where it needs to live.

The server name is CWEBSERVER, and the IP is From looking at IIS Manager, this is the site structure:

(Default Website) (root)
  - CONTENT (not a vDir)
  - DATAFOLDER (vDir, contains MVC app, just added by me, not working)

The strange thing is that when I type the following URL's from a browser on the server it works:


The following URL (which is the one that I NEED to work) doesn't:


The error I am getting is "The resource cannot be found."

After looking closer, I realized that requests to http://CWEBSERVER are going to the PRODUCTION vDir, but calls to http://localhost or are going to the root of the website. I guess this is something setup by the original site designer. I am not sure how to change this setup, but I don't think I can change it anyway because there are actually a ton of other directories that would be affected. The other thing I wanted to point out is this: the CONTENT folder is accessible by going to http://CWEBSERVER/CONTENT. This is really weird since I thought that the http://CWEBSERVER pointed me to the root, so I wouldn't think that the "/CONTENT" would actually be able to get to the CONTENT folder.

Now my problem is this: how do I get my DATAFOLDER accessible via http://CWEBSERVER/DATAFOLDER? I would think that I should just put the DATAFOLDER vDir inside of the PRODUCTION vDir. I tried it, and using the localhost or IP this is still accessible via:


When I use CWEBSERVER, however, it still fails:


The error is still "The resource cannot be found.". Can anyone shed some light on this? Specifically, I have these questions:

  1. How does http://localhost go to the root, and http://CWEBSERVER go to the PRODUCTION vDir? Where can I change this setting?
  2. Why would "http://localhost/PRODUCTION/DATAFOLDER/account.aspx" work but not "http://CWEBSERVER/DATAFOLDER/account.aspx"?

The accepted answer to this question (whom bounty will be awarded to) will need to be able to make it so I can access http://CWEBSERVER/DATAFOLDER/account.aspx. Thanks!

Best Answer

Most likely you have IIS bound to the IP address only. Go to IIS Manager, then go to properties on the website. Then, from the Web site tab, go to properties.

Add a identity for that host header value.

If necessary you can add multiple bindings.


I think I know what you want now. From IIS Manager, expand your default website. Then right click on the Production virtual directory and pick "Create Virtual Directory". Call this new one DATAFOLDER. Then tie this to the existing location on your file system.

I really think you need to clean this up a bit. The first thing I would do is decide how everything is really supposed to be accessed. In other words, when they type http://www.mysite.org/ What is that supposed to be? If it's the PRODUCTION directory, then Create a new site and point it to the PRODUCTION directory, then create your DATAFOLDER virtual app under it.

Related Topic