Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.


  • Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. 


    I have Local system connected to Server which has SQL server .When I use the Visual studio with below Connection string it works fine. But When I host it in my local IIS It throws error.

    Both my server and local machine are in the same domain and I am administrator in both.


        <add name="TestingName"


              connectionString="Server=MyServerName\SQLInstanceName;Database=MyDatabaseName; Trusted_Connection=True;"





    Error I get when I connect from Local IIS


    Login failed. The login is from an untrusted domain and cannot be used with Windo" +

        "ws authentication.   at System.Data.Common.DbProviderServices.GetProviderManifes" +

        "tToken(DbConnection connection)\r\n   at System.Data.Entity.ModelConfiguration.Uti" +

        "lities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProvide" +

        "rManifest& providerManifest)\r\n   at System.Data.Entity.DbModelBuilder.Build(DbCo" +

        "nnection providerConnection)\r\n   at System.Data.Entity.Internal.LazyInternalCont" +

        "ext.CreateModel(LazyInternalContext internalContext)\r\n   at System.Data.Entity.I" +

        "nternal.RetryLazy`2.GetValue(TInput input)\r\n   at System.Data.Entity.Internal.La" +

        "zyInternalContext.InitializeContext()\r\n   at System.Data.Entity.Internal.Interna" +

        "lContext.GetEntitySetAndBaseTypeForType(Type entityType)\r\n   at System.Data.Enti" +

        "ty.Internal.Linq.InternalSet`1.Initialize()\r\n   at System.Data.Entity.Internal.L" +

        "inq.InternalSet`1.get_InternalContext()\r\n   at System.Data.Entity.Infrastructure" +

        ".DbQuery`1.System.Linq.IQueryable.get_Provider()\r\n   at System.Linq.Queryable.Wh" +

        "ere[TSource](IQueryable`1 source, Expression`1 predicate)\r\n   at MYPROJECTProtoType.In" +

        "frastructure.Data.CheckManagement.CheckModule.Repositories.CheckRepository.Get(G" +

        "uid id) in C:\\Documents and Settings\\M\\My Documents\\Visual Studio 2010\\" +

        "Projects\\MYPROJECTPrototype\\Infrastructure.Data.CheckManagement\\CheckModule\\Repositori" +

        "es\\CheckRepository.cs:line 54\r\n   at MYPROJECTProtoType.Application.CheckManagement.Pa" +

        "nelModule.Services.CheckAppService.FindCheck(Guid ACheckId) in C:\\Documents and " +

        "Settings\\M\\My Documents\\Visual Studio 2010\\Projects\\MYPROJECTPrototype\\Applic" +

        "ation.CheckManagement\\CheckModule\\Services\\CheckAppService.cs:line 80\r\n   at MYPROJECT" +

        "ProtoType.DistributedServices.CheckManagement.CheckMgtModuleService.FindCheck(Gu" +

        "id ACheckId) in C:\\Documents and Settings\\PalanivelM\\My Documents\\Visual Studio " +

        "2010\\Projects\\MYPROJECTPrototype\\DistributedServices.CheckManagement\\CheckMgtModuleSer" +

        "vice.svc.cs:line 78"



    I get the same error for below Connection string as well.

        <add name="TestingName"
              connectionString="Data Source= MyServerName\SQLInstanceName;Initial Catalog= MyDatabaseName;
    User Id=MySQLUserID; password=MyPassword;  Trusted_Connection=True;
    " />
    But if i remove  Trusted_Connection=True  From connection string in both scenario 
    I get the below error when run in visual studio and IIS.
    "This operation requires a connection to the \'master\' database. Unable to create a" +
        " connection to the \'master\' database because the original database connection ha" +
        "s been opened and credentials have been removed from the connection string. Supp" +
        "ly an unopened connection.   at System.Data.Common.DbProviderServices.GetProvide" +
        "rManifestToken(DbConnection connection)\r\n   at System.Data.Entity.ModelConfigura" +
        "tion.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, D" +


    Any help would be appreciated


    • Edited by Andromeda Nebula Wednesday, January 11, 2012 11:14 AM
    • Moved by Bob Beauchemin Wednesday, January 11, 2012 3:41 PM Moving to the forum for SqlClient questions for best response. Also might consider submitting to the ASP.NET forums (From:.NET Framework inside SQL Server)
    • Moved by Allen_MSDNMicrosoft contingent staff Thursday, January 12, 2012 3:47 AM (From:ADO.NET Managed Providers)
    Wednesday, January 11, 2012 11:13 AM

All replies