I've been banging my head against the wall with this one for a couple days so I'm hoping someone has some ideas. I have a web service that I created that is called by a .NET class library (which in turn is called by another application). This all works fine in my development environment.
Test environment: Windows Server 2003, ASP 6.0, .NET 2.0, Anonymous authentication is enabled. All components (web service, DLL, and calling application) are all on the same server.
I first got the error "The request failed with HTTP status 401: Unauthorized." After some research I added...
< authentication mode="Windows" / >
< identity impersonate="true" / >
... to the web.config file for the web service and ...
iService.PreAuthenticate = true;
iService.Credentials = System.Net.CredentialCache.DefaultCredentials;
... to the class library code before the call to the web service.
After making that change, now I'm getting the error "The request failed with HTTP status 404: ." (no detail after the colon)
The web service works fine from the browser, it's only returning this error when called through the class library. I've tried a few things...
- Removed the virtual directory and recreated it
- Granted the IUSR and ASPNET accounts administrator priviledges to the virtual directory
- Added this code to the web.config file for the web service...
< defaultProxy >
< proxy usesystemdefault="false" / >
< / defaultProxy >
- Added this code to the class library before the web service call...
IWebProxy proxyObject = new WebProxy("http://testserver:8080", true);
iService.Proxy = proxyObject;
None of those changes resolved the issue, I still get the same error. (Note: From the same class library, I'm calling a couple other web services that reside on a different server and those calls are successful.)