Login failed for user"xxx" at the time of IIS hosting

Vote:
 

After hosting the application in IIS I am getting the follwing error when i am browsing the first page.

Login failed for user 'XXXXX\YYYYY$'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'XXXXX\YYYYY$'.

Source Error:

[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\ba53f11d\e7fb745a\App_global.asax.mfqw6opx.0.cs    Line: 0

Stack Trace:

[SqlException (0x80131904): Login failed for user 'XXXXX\YYYYY$'.]
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +1394
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1120
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +70
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +964
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +114
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1637
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +117
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +267
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +318
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +211
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +393
   System.Data.SqlClient.SqlConnection.Open() +122
   EPiServer.Data.Providers.ConnectionContext.b__15_0() +140
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +960
   EPiServer.Data.Providers.ConnectionContext.OpenConnection() +202
   EPiServer.Data.Providers.SqlDatabaseHandler.GetConnection(Boolean requireTransaction) +582
   EPiServer.Data.Providers.<>c__DisplayClass28_0`1.b__0() +41
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +960
   EPiServer.Data.SchemaUpdates.DatabaseVersionRetriever.GetDatabaseVersion(Boolean forceRefresh) +135
   EPiServer.Data.DatabaseVersionValidator.GetStatus(ConnectionStringsSection connectionStrings) +124
   EPiServer.Data.SchemaUpdates.<>c__DisplayClass6_0.b__0(IDatabaseSchemaUpdater u) +53
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +80
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +452
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   EPiServer.Data.SchemaUpdates.DatabaseSchemaManagerImplementation.EnsureDatabaseSchema(ConnectionStringsSection connectionStrings, Boolean automaticSchemaUpdatesEnabled, Boolean automaticSchemaCreationEnabled) +180
   EPiServer.Data.DataInitialization.Initialize(InitializationEngine context) +31
   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +56
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +244

[InitializationException: Initialize action failed for Initialize on class EPiServer.Data.DataInitialization, EPiServer.Data, Version=9.7.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +752
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +153
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +786
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +230
   EPiServer.Global..ctor() +104
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\ba53f11d\e7fb745a\App_global.asax.mfqw6opx.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1481
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +191
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +82
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +300
   System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext context) +44
   System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext context) +188
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +433


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0

WebConfig Connection String

 


 

#150209
Jun 14, 2016 7:16
Vote:
 

Looks like you are using integrated security which means IIS will use the configured apppool account to connect towards db, not the one you specify in connectionstring.config. Either ensure that the account the apppool is running on has access to the db or turn off integrated security and make sure the account in connectionstring.config has access.

#150211
Jun 14, 2016 8:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.