Link to home
Start Free TrialLog in
Avatar of anyoneis
anyoneisFlag for United States of America

asked on

Web Service Request Using localhost in the URL gives 404 error

System:
     IIS 5.0 Windows 2000 Advanced Server.
     ASP.NET 1.1
     Multiple Layers of web services, all running on the same server.

I recently was making a minor change to a web service that had not been changed for about a year. I could not get the changes to work. I tried restoring the old source files and I still could not get it to work.

I eventually figured out that the URL I had been using for the last 3 years was causing the problem. Web service WSA called web service WSB using a dynamic URL: "http://localhost/WSB/WSB.asmx".

When I changed "localhost" to the name of the machine that both web services are on, it worked. When I changed "localhost" to "appserver", which is the string just below "localhost" in my System32\Drivers\Etc\hosts file, and which also resolves to 127.0.0.1, it also works.

When I use "localhost", I get a 404 error, and the error I get indicates that instead of looking in the directory which is defined for the application: C:\WebStuff\WSB, IIS is looking in C:\inetpub\wwwroot\WSB.

What is going on here? I am assuming that the application WSA, or at least the Web Service Proxy, had not been recompiled for over a year, and by refreshing the web service reference, I cause that recompile. But, the URL is not compiled in, it is specified at runtime.

Thanks,
David
Avatar of manav_mathur
manav_mathur

Have yo uenabled virtual servers in IIS??
Avatar of anyoneis

ASKER

No. These web services are located on the default web site.
ASKER CERTIFIED SOLUTION
Avatar of manav_mathur
manav_mathur

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hmm. Well, now that you mention it... there is another web site defined called localhost. Perhaps what happened was that someone enabled it and caused my problem. If I understand virtual servers correctly, this site would get all messages referencing localhost, using the host header mechanism. But, how could it just pop up as a problem.

i am running off to ASPNET Connections for a week, so I'll look back into this in a week. Thanks for your ideas!

David

I haven't had time to test this, but I am fairly confident that manav_mathur's hypothesis is correct. So, let's close this!

Thank you!
David