"Unauthorized" when calling a Web Service from ASP.NET in the same solution.
I've got a small project, that has in it a simple web service (with the standard "HelloWorld" method in it), and a simple ASP.NET application that calls the web service. I'm using the built-in web server, and not IIS. I'm on Windows XP SP2, running VS.NET 2005 Beta2.
When I added the web reference, I added it using the "Web Services in this solution" link, and everything added correctly.
When I call the web service however, I get an exception whose details are: "The request failed with HTTP status 401: Unauthorized."
I figure this is a variation on the old 2-hop problem for windows authentication, so I went into the web service and changed the web.config from<authenticationmode="Windows"/> to<authenticationmode="None"/>This didn't fix the problem.
I then went into the web site properties for the web service, and unchecked the "NTLM Authentication" check box in the Server area. This fixed the problem, but I'm not sure what side affects it may have for debugging...
Is this a solution I can recommend to other developers having the same issue?
--
Chris Mullins
i assume that you're runnning VS2005, and using the built web server for the purpose. the shipped web server is meant for developement puprpose only, thus it on allows calls made from localhost. your recommnedation fix the propblem but exposes other secuirty and avaliability flaws. I would recommed setting up an IIS virtual directory for testing to consumers where all the security and performance setting can be properly setup.
I am running VS.NET 2005. I am also just doing this for development purposes at this point. The problem is that even in development, I'm getting an UnAuthorized exception.
As for using IIS, that's a last resort. Using the file-system based web site and web service makes everything so much better that we're going to stick with it.
I don't see what security and availability flaws my fix exposes - please let me know! It's not as if we're deploying using the personal web server - just developing on the workstations with it.
--
Chris Mullins