web access failed - argghh

M

Microsoft

Hello all,

Here's the setup:

I've got VS.NET 2003 installed on a Windows 2003 Server. I've got multiple
sites configured as listed below using host headers:

dev.mydomain.com
ip: 127.0.0.1
host headers: dev.mydomain.com, empty (as in no value)
root directory: e:\web sites\dev.mydomain.com
root directory is shared as wwwroot$

www.someotherdomain.com
ip: my server's only external ip
hostheaders: www.someotherdomain.com, someotherdomain.com
root directory: e:\web sites\www.someotherdomain.com

Now, when I try to create an ASP.NET application using
http://localhost/appname, I get the dreaded web access failed message. The
weird part is, the physical path it is trying to use is the physical root
directory of the second web site (i.e. e:\web
sites\www.someotherdomain.com). Since of course, I am specifying localhost,
the first website, the paths are conflicting and visual studio .net is
complaining about a valid conflict. This I understand.

What I don't understand is, given that the dev.mydomain.com website is the
only website configured to listen on 127.0.0.1 on my server, and also given
that I am specifying localhost in the url, which cannot resolve to anything
other than 127.0.0.1 (as specified in the hosts file), how in the heck is
VS.NET obtaining the physical root path for the OTHER domain? Sure, I can
make the site work if I manually type in the correct path each time I create
a project, but I shouldn't have to, and I don't want to force my other
developers to do so.

Any thoughts?
 
C

Chris

Forgive the accidental post under the name Microsoft. I had mis-read the
settings box when configuring the news account. Most humble apologies...
 
C

Chris

Well, I'm still hoping someone replies, but I thought I'd list my interim
solution in case others have come across this problem:

1. Open IIS, right click on the actual site you're trying to use for
development.
2. Ensure that it is the default site by making sure it lists on all IP
addresses on port 80, and will accept any host header (this config is
default for the Default Web Site).
3. Right click the site itself and click Backup Configuration, save config
backup somewhere on your server
4. Right click the IIS root in the mmc and click Restore Configuration.
5. Browse to and select the backup you just created, select the site you're
trying to restore (should be only 1 in the backup file).
6. When prompted, choose the option to replace the existing site.

Apparently, here's what goes down:

Visual Studio .NET is picking up configuration info for whatever site was
last created, not the default web site as you might assume. Therefore, if
you create an additional site beyond the Default Web Site, and try to use
the Default Web Site for development, you'll get path errors and the "Web
access failed" dialog. By doing a backup/restore with the replace option,
you tell IIS to remove the original site and recreate the default website,
which now has a more recent site ID in the metabase. This causes VS.NET to
pick up the configuration information for the newly restored site, instead
of the previously created site. Because of this, your expected physical
path will now be correct, and VS.NET will carry on happily.

I don't like this solution, because I have to do it everytime I want to add
another virtual server, but hey it works without fail. It's also worth
noting that because you're doing a backup/restore from within IIS, all of
the virtual directory settings within the site are maintained in the
re-created version of the site, so there are no issues there.

Microsoft said:
Hello all,

[snip]

Now, when I try to create an ASP.NET application using
http://localhost/appname, I get the dreaded web access failed message.
The weird part is, the physical path it is trying to use is the physical
root directory of the second web site (i.e. e:\web
sites\www.someotherdomain.com). Since of course, I am specifying
localhost, the first website, the paths are conflicting and visual studio
.net is complaining about a valid conflict. This I understand.

What I don't understand is, given that the dev.mydomain.com website is the
only website configured to listen on 127.0.0.1 on my server, and also
given that I am specifying localhost in the url, which cannot resolve to
anything other than 127.0.0.1 (as specified in the hosts file), how in the
heck is VS.NET obtaining the physical root path for the OTHER domain?
Sure, I can make the site work if I manually type in the correct path each
time I create a project, but I shouldn't have to, and I don't want to
force my other developers to do so.
[snip]
 
S

Steven Cheng[MSFT]

HI Chris,

First, I shall thank you for sharing your experience on this issue with us.
As for the problem when creating asp.net web application in IIS, yes, what
you've found is correct, the VS.NET dosn't really locate the file shared
path from the sitename you specified in the http url, but from some cached
storage which contains the site path that is previously used. And this is
the existing problem when we creating web site through fileshare mode(the
default mode).

Also, when using host headers, it is recommended that we avoid using the
"localhost" as the site name, but use the host header names. And instead of
using File share mode, we can use the PFSE mode which will no longer look
for any shared folder but directly locate the path from the http url
address we specify at the begining.

In addition, in VS.NET2005, ASPNET2, the new "Projectless" asp.net
development feature may greatly improve the asp.net web application
development. We'll no longer need to struggle with the web applicaiton
project file and we can create a web application directly on a normal
filesytem folder rather than IIS vdir.

Thanks again for your posting.


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top