Vipin
Vipin

Reputation: 31

System.Net.WebException: The remote server returned an error: (401) Unauthorized in WCF hosted in Windows Service

I have a WCF service which is hosted in Windows Service and windows service is running with "Local System Account". Service is trying to download a file from SharePoint server and failed with error:

System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName)

Similar setup is working in another machine and service is able to communicate with Sharepoint site but not in my server. I have tried this setup in another machine but same error except one machine.

What kind of permissions are required to communicate with SharePoint? Also, how can I check what are the credential passed during request?

Upvotes: 0

Views: 3484

Answers (1)

Mohammed Ali
Mohammed Ali

Reputation: 1067

If certificates are involved here, see if this is a certificate issue. Use the MMC snap-in and compare the certs on the working and non-working machines.

Upvotes: 1

Related Questions