When I attempt to connect to an intranet web service from a web application running on IIS Express that web service returns a 403 Forbidden. The service works correctly when I access via unit tests or from the same site running on Cassini or on under IIS 7.5 on my server. My gut tells me this is a configuration issue, but I'm not sure where to begin looking.
What would cause a remote web service to return a 403 Forbidden when that service is accessed from a site running on IIS Express?
To clarify the service I am accessing is not SOAP based. I am setting up a specific network credential and passing it along with my request which the below code illustrates.
protected XDocument Search(Uri requestUri)
{
var nc = new NetworkCredential(this.config.ServiceUserName,
this.config.ServicePassword);
var cCache = new CredentialCache();
cCache.Add(requestUri, "Basic", nc);
var request = (HttpWebRequest)HttpWebRequest.Create(requestUri);
request.Credentials = cCache;
request.PreAuthenticate = true;
request.Method = WebRequestMethods.Http.Get;
var response = (HttpWebResponse)request.GetResponse();
return XDocument.Load(new StreamReader(response.GetResponseStream()));
}