My ASP.NET web site calls a .net service from a code in App_Code to retrieve some information.
The web service is hosted at http://mydomain/ws/DirectoryService
Ensure you are running the webservice and website on different ports, and make sure your configuration reflects the correct port.
If you are running two websites on the same port (by default this would be port 80, reserved for HTTP), they will conflict with each other - one of them will get the port, the other will not.
Say you change the web service port to 8080, you would configure the site to use the endpoint:
address="http://mydomain:8080/ws/DirectoryService.asmx"
Problem solved. It turned out that I needed to Edit an anonymous authentication settings, so that when used (in my case it is always), the code would go under application pool's identity, and not IUSR: