Authentication 互联网应用

Authentication 互联网应用,authentication,asp.net-mvc-4,Authentication,Asp.net Mvc 4,默认的ASP.NET MVC 4项目,其帐户控制器使用窗体身份验证,但此身份验证在我的服务器上的IIS 7.5上出现此错误 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 correc

默认的ASP.NET MVC 4项目,其帐户控制器使用窗体身份验证,但此身份验证在我的服务器上的IIS 7.5上出现此错误

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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.) 

由于在类中找不到任何连接,如何解决此问题。

您应该按照异常消息中的建议检查Windows日志。连接字符串位于web应用程序的web.config文件中。

默认的MVC 4项目依赖于IIS Express和LocalDB,生成的LocalDB存储在App_数据文件夹中

但是,当将项目更改为在完全IIS下运行时,建议您切换到使用SQL Express。为此,您需要创建一个数据库并设置相关的连接字符串。假设您的应用程序具有相关权限,并且WebSecurity.InitializeDatabaseConnection将autoCreateTables设置为true,则将自动创建相关表


默认数据库初始化是通过InitializeSimpleMembershipAttribute完成的。我们可以在Filters/InitializeSimpleMembershipAttribute.cs中找到此属性,然后将其应用于AccountController。

您是否实际设置了数据库?您的连接字符串使用的是什么?但这在本地主机和web.config唯一连接“DefaultConnection”上起作用,我真的不知道登录数据存储在哪里。好了,现在我找到了WebSecurity.InitializeDatabaseConnection,使用默认连接。现在我正在尝试调试下一步。我的问题是EntityFramework与此连接不兼容。