Connection String to connect to database RRS feed

  • Question

  • This is my connection string, which the web service (hosted in IIS running under ApplicationPoolIdentity) uses to connect to database

    <add name="AdventureWorksEntities"connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl;
    provider=System.Data.SqlClient;provider connection string='Data Source=TestMachine;Initial Catalog=AdventureWorks;
    Integrated Security=True;Connection Timeout=60;multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />

    When I try to access the site I am getting an exception: Login Failed for user MyDomain\TestMachine$.

    Why is IIS trying to use TestMachine to connect and not my user account (e.g MyDomain\TestUser) ? How do I specify it to use the context of the user that made the request ?

    • Edited by Shawn Dan Tuesday, October 30, 2012 11:52 PM
    Tuesday, October 30, 2012 10:37 PM


  • Hi Shawn,

    Welcome to the MSDN forum.

    Please try this:

    <add name="AdventureWorksEntities"connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl;provider=System.Data.SqlClient;provider connection string='Data Source= TestUser;Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />

    Have a nice day.

    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Alexander Sun Friday, November 9, 2012 8:55 AM
    Thursday, November 1, 2012 7:49 AM