We help IT Professionals succeed at work.

Subsequent DB access permissions fail?

I have a website built from the CodeSmith/PLINQO sample generator - it works like a champ on the development PC; the app will do exactly what I need very nearly straight out-of-the-box; but...

When I deploy it, only the first page works! The main page returns the list of tables just fine. Any drilldown to open the menu specified tables does not. The failure message is "Login failed for user 'NOVATECHESG\Appserver$'. NOVATECHESG is our domain name and the application server is "Appserver"; I get that. But why the change? I have experimented with the permissions on the host server, but nothing I do there seems to matter...

I have anonymous user turned off on the website; so I login when accessing the webpage - Windows authentication is active at both the web and DB servers.

Why does the first call work and subsequent calls don't? Why would they not use the same username\password?  Is there a setting in the project that I'm missing?

Any constructive advice would be appreciated!

Server Error in '/' Application.

Login failed for user 'NOVATECHESG\APPSERVER$'. 
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 'NOVATECHESG\APPSERVER$'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[SqlException (0x80131904): Login failed for user 'NOVATECHESG\APPSERVER$'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.SqlClient.SqlConnection.Open() +122
   System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) +44
   System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() +45
   System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() +20
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +57
   System.Data.Linq.Table`1.GetEnumerator() +43
   System.Data.Linq.Table`1.System.Collections.IEnumerable.GetEnumerator() +4
   System.Web.DynamicData.Misc.FillListItemCollection(MetaTable table, ListItemCollection listItemCollection) +637
   System.Web.DynamicData.ForeignKeyFilterDelegate.PopulateListControl(ListControl listControl) +25
   System.Web.DynamicData.FilterUserControlBase.PopulateListControl(ListControl listControl) +25
   FilterUserControl.Page_Init(Object sender, EventArgs e) in c:\Development\NovaTech.Catalog.Editor\Stellar.UI\DynamicData\Content\FilterUserControl.ascx.cs:34
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnInit(EventArgs e) +99
   System.Web.UI.UserControl.OnInit(EventArgs e) +77
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +198
   System.Web.UI.ControlCollection.Add(Control child) +80
   System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +106
   System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +443
   System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51
   System.Web.UI.WebControls.Repeater.DataBind() +75
   System.Web.DynamicData.FilterRepeater.DataBind() +22
   System.Web.DynamicData.FilterRepeater.Page_InitComplete(Object sender, EventArgs e) +37
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Page.OnInitComplete(EventArgs e) +8698006
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +467


Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082

Open in new window

This is a picture of the first page showing tables gathered - DB login and first query success
Watch Question

Most Valuable Expert 2012
Top Expert 2014

Do you use the same connection string? What do you try to do when the error occurs (What query etc)?
Miles ThorntonSenior C# Developer and TFS Administrator


CodeCruiser, Thank you for the post.

There is only one connection string for this application - and that has no user ID/PWD in it.
I think what's happening is that PLINQO is using the original login ID/PWD on the first page - which works; and thereafter is using the application pool's identity; which isn't in the SQL Server's list of authenticated users - thus the fail...

Senior C# Developer and TFS Administrator
I have resolved this issue by adding the server's application pool identity to SQL Server's list of authenticated users.

I must say that I am dissappointed by the lack of responses from the community. This is the first time this has happend; but I am dissapointed just the same... :-(

Are there no PLINQO experts out there?