title: Error message: The request for security token could not be satisfied because authentication failed
body: <p>I am trying to access a WCF service (MS CRM 2011) and getting the above error.  If I run my sample program from the VS2010 debugger with either Cassini or IIS Express it works great.  No authentication errors.</p>
  
  <p>However, if I publish the site to my local IIS 7.5 (running Windows 7 64 bit), I get the error on the line that grabs the CRM UserId (WhoAmIResponse).</p>
  
  <p>I opened Fiddler to compare the requests between running under the debugger and running under IIS.  On the site running under IIS the request never even comes across, so it must be failing before getting that far.</p>
  
  <p>The site as published to IIS has its web.config set for ...</p>
  
  <pre><code>    &lt;authentication mode="Windows"&gt;
      &lt;/authentication&gt;
      &lt;identity impersonate="true"/&gt;
  </code></pre>
  
  <p>The site is running under the preinstalled ASP.NET v4.0 app pool, Integrated pipeline mode, ApplicationPoolIdentity account.</p>
  
  <p>Here is my code...</p>
  
  <pre><code>public class DemoController : Controller
  {
      public ActionResult Index()
      {
          ClientCredentials credentials = new ClientCredentials();
          credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
  
          var _serviceProxy = new OrganizationServiceProxy(new Uri("http://svr-rex2011-dev/TimeEntry/XRMServices/2011/Organization.svc"),
                                                              null,
                                                              credentials,
                                                              null);
  
          // This statement is required to enable early-bound type support.
          _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
  
          IOrganizationService service = (IOrganizationService)_serviceProxy;
  
          // Display information about the logged on user.
          Guid userid = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).UserId;
          SystemUser systemUser = (SystemUser)service.Retrieve("systemuser", userid,
              new ColumnSet(new string[] { "firstname", "lastname" }));
  
          // Retrieve the version of Microsoft Dynamics CRM.
          RetrieveVersionRequest versionRequest = new RetrieveVersionRequest();
          RetrieveVersionResponse versionResponse =
              (RetrieveVersionResponse)service.Execute(versionRequest);
  
          ViewBag.FirstName = systemUser.FirstName;
          ViewBag.LastName = systemUser.LastName;
          ViewBag.Version = versionResponse.Version;
  
          return View();
      }
  
  }
  </code></pre>
  
  <p>Any ideas?  Much appreciated!!!</p>