문제

I have a web service that uploads documents to Sharepoint and works fine using

System.Net.ICredentials creds = System.Net.CredentialCache.DefaultCredentials;
context.Credentials = creds;

I have re-used this code in another project and I get the error:

System.Net.WebException was unhandled by user code
Message=The remote server returned an error: (401) Unauthorized.

As far as I can see everything is the same in the config files and don't know why its failing. Any ideas?

도움이 되었습니까?

해결책

I solved it for anyone who might come across a problem like this.

The problem is in IIS, it is using the default application pools. Simply change it from default to your custom pool where the "Identity" field is your PC name or Login Credentials. This can be done to the default App pool, however, if you have existing projects using this pool, it is advisable to create a new App pool so you don't break existing projects.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top