2016-05-18 54 views
0

我目前正在開發一個web應用程序,但我甚至無法註冊第一個用戶。 Webconfig的連接字符串正常工作。我可以立即更新刪除或創建應用產品和數據庫更新,這表明(我認爲)連接字符串的工作正常。我在MVC中創建了一個新的項目,我沒有改變任何東西,並且stil不能註冊用戶。在30-60秒之後它的顯示出現以下錯誤。我提到的連接字符串的原因是錯誤提一個SQL例外,談論錯誤的連接字符串,但顯然這是工作的罰款,這是一個新的不變MVC proyect 感謝ASP.NEt身份不能正常工作或正在註冊

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:

Line 153: { Line 154: var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; Line 155: var result = await UserManager.CreateAsync(user, model.Password); Line 156: if (result.Succeeded) Line 157: {

Source File: C:\Users\IronMan\Documents\Visual Studio 2015\Projects\training\IDTest\IDTest\Controllers\AccountController.cs Line: 155

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) +92
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover, SqlAuthenticationMethod authType) +372
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +172
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +849
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionSt

越來越像上述

+0

可能嘗試http://stackoverflow.com/questions/33111611/entity-framework-6-the-server-was-not-found-or-was-not-accessible – Claies

+0

這個答案可能會幫助你 - [如何添加ASP.NET MVC5身份驗證到現有的數據庫](http://stackoverflow.com/questions/25651342/how-to-add-asp-net-mvc5-identity-authentication-to-existing-database/25651908#25651908) – Win

+0

嘿贏這正是發生了什麼 – shark6552

回答

1
  1. 查找DataContext類
  2. ,因爲它寫在web.config文件中的連接字符串鍵的
  3. 設置默認值

我認爲這個問題是,當你試圖創建用戶時,它會創建無法找到你的cnnection字符串的數據上下文。

+0

所以我發現註冊的控制器使用默認的連接字符串,我改變了我用來生成我的表的連接字符串,現在它可以正常工作BUt – shark6552

相關問題