1

I am getting Internal Server error 500 while making a call to WCF service from code behind. I am not using any proxy or reference but trying to make a call with HTTPWebRequest object.

I have my application pool running under some service account and WCF service requires the call to be made under windows credentials only. Code works fine if I change the identity of apppool to my windows credentials, but need is to run my appool under service account only.

So, my primary question is how do I make this call with windows Credentials ? I tried following but none of them worked :

  1. Uri uri = new Uri(myServiCeUrl); ICredentials credentials = CredentialCache.DefaultCredentials; NetworkCredential credential = credentials.GetCredential(uri, "Basic"); webRequest.Credentials = credential;

    1. webRequest.UseDefaultCredentials = true;
    2. webRequest.Credentials = CredentialCache.DefaultNetworkCredentials;
    3. webRequest.Credentials = (ICredentials)System.Security.Principal.WindowsIdentity.GetCurrent(true);
    4. webRequest.Credentials = CredentialCache.DefaultNetworkCredentials;

Please help and share your thoughts.

4

0 回答 0