ASP.NET MVC 4 with Simple Membership Issues

Discussion in 'General troubleshooting' started by rbeaver, May 19, 2013.

  1. Guys,

    I have a fairly basic asp.net mvc 4 application which utilizes simple membership for security. I have the database on win host updated to reflect that, and can use the connection string provided by Winhost to connect and run my app locally while connecting to the win host db server. But, the moment I upload my files to win host, and attempt to hit the application I get a pretty confusing error message. Of the exceptions the four main headers are:

    System.ComponentModel.Win32Exception: The system cannot find the file specified

    [Win32Exception (0x80004005): The system cannot find the file specified]

    [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071

    [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]

    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]

    [InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]

    [TargetInvocationException: Exception has been thrown by the target of an invocation.]

    Everything seems to be pointing towards a bad connection string, but I have one, my simple membership tables are included in my database, and it works great locally hitting the database server. I even thought that I might have another string running around in my config that was point to the simple membership db locally, but I've checked it 3 times.

    Any suggestions?
    Ryan
     
    Last edited by a moderator: Oct 14, 2015
  2. Tabitha

    Tabitha WinHost HBIC

    Can you give us the URL where you're getting this error, and provide your connection string (you can asterisk out personal information)?
     
  3. Info that was requested

    Sure Tabatha,

    Here is the info you've requested:
    http://www.pugsleytraining.org/

    (I have custom errors turned off for now, so that should show you the error)

    I've attached the config and renamed it with .txt.

    Thanks in advance!
    Ryan
     

    Attached Files:

  4. Ray

    Ray

    Actually the link provided to a blog posting may not be the correct blog. The blog is referencing to connecting a local DB on the web server. That is SQL Express and we do not use or support SQL Express. SQL Express will mean we install the SQL engine on the web server. Rather then support SQL Express we offer a full SQL server the customer can utilize.
    The error I am getting when I pull up http://www.pugsleytraining.org is :

    Server Error in '/' Application.
    --------------------------------------------------------------------------------


    The system cannot find the file specified
    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.ComponentModel.Win32Exception: The system cannot find the file specified

    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.

    This is a database connection issue. If your code is trying to look for a SQL Express database then that will fail and you will need to make sure it is trying to connect and successfully connect to the full SQL server associated to your account. If you are sure that it is connecting to the SQL server, check the SQL server itself and make sure that the necessary objects/tables do exists on the SQL database. I cannot tell you for sure what tables or objects it is looking for, only the developer and designer of your site can answer that.
     
  5. Hi,

    I am getting the same issue. I have tried the connection string and i still can't find the error. I visited your webpage http://www.pugsleytraining.org and i see that you have resolved the issue. Please what did you do to have this working? I have spent almost all day on this problem. The site was working fine but now it no longer work.

    Here is the error i am getting:

    Server Error in '/' Application.
    The system cannot find the file specified
    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.ComponentModel.Win32Exception: The system cannot find the file specified

    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:

    [Win32Exception (0x80004005): The system cannot find the file specified]

    [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296071
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5308555
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +225
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +558
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +67
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +83
    System.Data.SqlClient.SqlConnection.Open() +96
    System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +79
    System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +384
    System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +241
    System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +26

    [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
    System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +170
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +32

    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +192
    System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +39
    System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +46
    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +123
    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +468
    System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps() +17
    System.Data.Entity.Database.Exists() +36
    PHIWebsite.Filters.SimpleMembershipInitializer..ctor() in c:\a\src\Customer Dashboard\PHIWebsite\PHIWebsite\Filters\InitializeSimpleMembershipAttribute.cs:34

    [InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
    PHIWebsite.Filters.SimpleMembershipInitializer..ctor() in c:\a\src\Customer Dashboard\PHIWebsite\PHIWebsite\Filters\InitializeSimpleMembershipAttribute.cs:45
     

Share This Page