I have a custom IRM module and a custom webservice, both installed into Sharepoint. The module attempts to call the service with the following code:
MyService lService = new MyService();
lService.Url = SERVER_URL + MY_SERVICE_URL;
lService.Credentials = new System.Net.NetworkCredential(SERVICE_CRED_USER, SERVICE_CRED_PASS, SERVICE_CRED_DOMAIN);
bool lResult = lService.TestMethod();
In my development environment this works fine, in the live environment (with a much more complicated SharePoint setup) I get:
Critical Error: The request failed with HTTP status 401: Unauthorized.-
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
In both cases the credentials being used are those of a user on the local machine. The credentials in question can log in to the SharePoint site.
So can anyone shed any light on what might be going wrong?
I've spent a good few hours trawling Google for Sharepoint and 401 but so far no joy (this doesn't appear to fit the symptoms for a loopback error as there are no Failure Audits in the security log).
Edit: I tried temporarily disabling the loopback check and it didn't help. I've also found out that the live environment is only on SP1 where as the environment is on SP2, not sure that that should matter though.