title: How do I properly host a WCF Data Service that connects to SQLServer in IIS? Why am I getting errors?
body: <p>I'm playing around with WCF Data Services (ADO.NET Data Services).  I have an entity framework model pointed at the AdventureWorks database.</p>
  
  <p><strong>When I debug my svc file from within Visual Studio, it works great.</strong>  I can say /awservice.svc/Customers and get back the ATOM feed I expect.</p>
  
  <p>If I publish the service (hosted in an ASP.NET web application) to IIS7, the same query string returns a 500 fault.  The root svc page itself works as expected and successfully returns ATOM.  The /Customers path fails.</p>
  
  <p>Here is what my grants look like in the svc file:</p>
  
  <pre><code>public class AWService : DataService&lt;AWEntities&gt;
  {
      public static void InitializeService( DataServiceConfiguration config )
      {
          config.SetEntitySetAccessRule( "*", EntitySetRights.All );
          config.SetServiceOperationAccessRule( "*", ServiceOperationRights.All );
          config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
      }
  }
  </code></pre>
  
  <p><strong>Update:</strong> I enabled verbose errors and get the following in the XML message:</p>
  
  <pre><code>&lt;innererror&gt;
  &lt;message&gt;The underlying provider failed on Open.&lt;/message&gt;
  &lt;type&gt;System.Data.EntityException&lt;/type&gt;
  &lt;stacktrace&gt;
     at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(
  ...
  ...
  &lt;internalexception&gt;
  &lt;message&gt;
  Login failed for user 'IIS APPPOOL\DefaultAppPool'.
  &lt;/message&gt;
  &lt;type&gt;System.Data.SqlClient.SqlException&lt;/type&gt;
  &lt;stacktrace&gt;
     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, ...
  </code></pre>