2014-1202

provider: SQL Network Interfaces, error: 26

作者: momy 分类: 编程开发 0 Comment »
摘要:provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified解决方法

做ASP.NET MVC开发的时候,经常会出现一下错误:

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: 26 - Error Locating Server/Instance Specified)


这里给出一种解决方法:

删除cookie里边的.ASPXAUTH就可以了


具体原因是英文MVC4的SimpleMembership身份验证有检查数据库是否初始化的过程,由于您之前已经登录过,浏览器记录了您的登录状态,程序没有调用初始化SimpleMembership的流程而产生这个错误。


具体解决方法是:在用WebSecurity之前要判断是否初始化,如:if (!WebSecurity.Initialized){WebSecurity.CurrentUserName}或者添加[InitializeSimpleMembership]属性标记。


标签: SQL Network Interfaces, error: 26 阅读: 11034
上一篇: ASP.NET MVC BundleStyle/BundleScript 403错误 - 11158次
下一篇: MVC5 Controller构造方法获取User为空解决方法 - 15727次

向右滑动解锁留言