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.

  • a 500 error would have nothing to do with your request and everything to do with your service account. Make sure your service account is in the IIS_IUSRS user group. The 500 error means IIS is not correctly configured and will not respond. – Aron Jul 15 '13 at 07:29
  • To get Windows Auth to work on IIS you need to use Negociate or NTLM, and NOT Basic. There should be information on SO on that. – Aron Jul 15 '13 at 07:30

0 Answers0