[Resolved] SQL Server due to failure in retrieving the user's local application data path.

Jul 13, 2010 at 8:39 PM
Edited Jul 13, 2010 at 8:41 PM

I'm getting the following error when I attempt to attach the Commerce.mdf file to SQL Server Express2008. It appears that user 'JHSW500B\Joe Stagner' is the issue.

In SQL Server Management Studio I get the following error when trying to modify the schema owner:Cannot find the user 'JHSW500B\Joe Stagner', because it does not exist or you do not have permission.

 

Server Error in '/' Application.

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

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: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

Source Error:

Line 34: 
Line 35:                     RepeaterItemsList.DataSource = query;
Line 36:                     RepeaterItemsList.DataBind(); 
Line 37:                 }
Line 38:                 catch (Exception exp)


Source File: C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs    Line: 36

Stack Trace:

[SqlException (0x80131904): Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +308
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2624
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +1076
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +309
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +350
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +509
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +984
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +91
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1908
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +270
   System.Data.SqlClient.SqlConnection.Open() +299
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67

[EntityException: The underlying provider failed on Open.]
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +305
   System.Data.EntityClient.EntityConnection.Open() +141
   System.Data.Objects.ObjectContext.EnsureConnection() +97
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
   System.Data.Objects.ObjectQuery`1.GetIListSourceListInternal() +30
   System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +72
   System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +84
   System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() +425
   System.Web.UI.WebControls.Repeater.GetData() +18
   System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +344
   System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +165
   TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:36

[Exception: ERROR: Unable to Load Popular Items - The underlying provider failed on Open.]
   TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:40
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +116
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.BasePartialCachingControl.LoadRecursive() +143
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2750



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

<!-- [SqlException]: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) [EntityException]: The underlying provider failed on Open. at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.GetIListSourceListInternal() at System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) at System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) at System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() at System.Web.UI.WebControls.Repeater.GetData() at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) at TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:line 36 [Exception]: ERROR: Unable to Load Popular Items - The underlying provider failed on Open. at TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:line 40 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.BasePartialCachingControl.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->

Jul 13, 2010 at 8:52 PM

I'm continuing to investigate this error and I'm now coming up with the following error:

I believe this is because I don't have account : 'JHSW500B\Joe Stagner'

 

CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\Spyworks\App_Data\Commerce.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

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: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\Spyworks\App_Data\Commerce.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Source Error:

Line 34: 
Line 35:                     RepeaterItemsList.DataSource = query;
Line 36:                     RepeaterItemsList.DataBind(); 
Line 37:                 }
Line 38:                 catch (Exception exp)


Source File: C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs    Line: 36

Stack Trace:

[SqlException (0x80131904): CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\Spyworks\App_Data\Commerce.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +308
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2624
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +1076
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +309
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +350
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +848
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +984
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +91
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1908
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +270
   System.Data.SqlClient.SqlConnection.Open() +299
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67

[EntityException: The underlying provider failed on Open.]
   System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +305
   System.Data.EntityClient.EntityConnection.Open() +141
   System.Data.Objects.ObjectContext.EnsureConnection() +97
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
   System.Data.Objects.ObjectQuery`1.GetIListSourceListInternal() +30
   System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +72
   System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +84
   System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() +425
   System.Web.UI.WebControls.Repeater.GetData() +18
   System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +344
   System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +165
   TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:36

[Exception: ERROR: Unable to Load Popular Items - The underlying provider failed on Open.]
   TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:40
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +116
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.BasePartialCachingControl.LoadRecursive() +143
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Control.LoadRecursive() +206
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2750



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

<!-- [SqlException]: CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Spyworks\App_Data\Commerce.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) [EntityException]: The underlying provider failed on Open. at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.GetIListSourceListInternal() at System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) at System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) at System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() at System.Web.UI.WebControls.Repeater.GetData() at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) at TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:line 36 [Exception]: ERROR: Unable to Load Popular Items - The underlying provider failed on Open. at TailspinSpyworks.Controls.PopularItem.Page_Load(Object sender, EventArgs e) in C:\TailspinSpyworks-v0.8\Source\TailspinSpyworks\Controls\PopularItem.ascx.cs:line 40 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.BasePartialCachingControl.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
Jul 13, 2010 at 9:46 PM

I ended up getting the site to work by creating a new App Pool and setting the user to a SQL Server SysAdmin account. I made sure that that account was the DB Owner on the commerce database.

Jul 14, 2010 at 9:34 PM
Edited Jul 25, 2010 at 9:46 PM

Check out my post under Commerce DB