建立连接时发生与网络相关或特定于实例的错误 [英] A network-related or instance-specific error occurred while establishing a connection

查看:128
本文介绍了建立连接时发生与网络相关或特定于实例的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个asp.net mvc5应用程序。



但有时候我会得到这个错误(见下文)。但奇怪的是,在浏览器中清除缓存之后,错误消失了。



Hi,

I have a asp.net mvc5 application.

But sometimes I get this error(see below). But the strange thing is that, after I clear cache in the browser the error dissapear.

Quote:



建立与SQL Server的连接时发生网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 查找指定的服务器/实例时出错)

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



SQLExpress数据库文件自动创建错误:

连接字符串使用应用程序的App_Data目录中的数据库位置指定本地Sql Server Express实例。提供程序尝试自动创建应用程序服务数据库,因为提供程序确定数据库不存在。以下配置要求是成功检查应用程序服务数据库是否存在以及自动创建应用程序服务数据库所必需的:



如果应用程序在Windows 7上运行或Windows Server 2008R2,需要特殊配置步骤才能自动创建提供程序数据库。有关其他信息,请访问: http://go.microsoft.com/fwlink/?LinkId=160102 [ ^ ]。如果应用程序的App_Data目录尚不存在,则Web服务器帐户必须具有对应用程序目录的读写权限。这是必要的,因为如果Web服务器帐户尚不存在,它将自动创建App_Data目录。

如果应用程序的App_Data目录已经存在,则Web服务器帐户只需要对应用程序的读写访问权限App_Data目录。这是必要的,因为Web服务器帐户将尝试验证应用程序的App_Data目录中是否已存在Sql Server Express数据库。从Web服务器帐户撤消对App_Data目录的读取访问将阻止提供程序正确确定Sql Server Express数据库是否已存在。当提供程序尝试创建现有数据库的副本时,这将导致错误。需要写访问权限,因为在创建新数据库时会使用Web服务器帐户的凭据。

必须在计算机上安装Sql Server Express。

Web的进程标识服务器帐户必须具有本地用户配置文件。有关如何为计算机和域帐户创建本地用户配置文件的详细信息,请参阅自述文档。



源错误:

在执行当前Web请求期间生成了未处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别。


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)
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.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102[^]. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

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.





谢谢



Thank you

推荐答案

TITLE: Connect to Server
------------------------------

Cannot connect to admin-PC or server.

------------------------------
ADDITIONAL INFORMATION:

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
SOLUTION :-

1.click on Start button.

2.Search on Search Bar.

3.Type Services.And Click on that

4.And go to Sql Server(MSSQLSERVER).

5.Right click on it.and Click on Start button.

6.And go back to sql Server Close it and connect it again.


这篇关于建立连接时发生与网络相关或特定于实例的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆