R – Service developed on 32bit windows xp pro, fails to run on windows server 2003 64-bit

netweb serviceswindows-server-2003windows-services

A windows service was developed and runs on a 32 bit machine. It communicates to the Project Web Access web service. Now, the service was moved to the same computer as the Project Web Access web service. The code fails and I recieve this error:

System.Net.WebException: The
request failed with HTTP status 401:
Unauthorized. at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream
responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
ProjToolService.ProjectWebSvc.Project.ReadProject(Guid
projectUid, DataStoreEnum dataStore)
at
ProjToolService.Queue.AssignResource(Guid
queueId, Guid projectId, Guid taskId,
Guid resourceId, Guid assignmentId)

It may not be the 32bit vs 64bit, but I have no other ideas.

The target platform is x86, but it also failed using AnyCPU. I tried using DefaultCredentials and System.net.CredentialCache.DefaultNetworkCredential as well.

Best Answer

401 is a HTTP status, so it shouldn't have anything to do with the 32 vs 64 bit. I would check and make sure that the web service is setup using the correct crednentials (especially if you are planning on using anonymous access).

If I remember correctly the DefaultNetworkCredential pulls the account running the service, so I would check to make sure the account for the service you are using has the appropriate authorities to access the web service. The easy way to check this is give the account running the service administrative access to the machine (then take it away when you're done). if it works, then it is a permissions problem. If not, then you know it's something else.

To give the account rights go to Administrative Tools -- > Computer Management -- >Local Users And Groups -- > Groups. Add the Network User to the appropriate group (like I said I would start with admin and work my way down.)

Related Topic