2016-05-18 47 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