网络相关的SQL服务器错误 [英] Network related SQL server error

查看:83
本文介绍了网络相关的SQL服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有

i有一个asp.net网站,我想在iis上运行

但是当我在iis管理器上点击浏览时

i在index.aspx页面中获取此错误



建立与SQL Server的连接时发生网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:50  - 发生本地数据库运行时错误。无法创建自动实例。请参阅Windows应用程序事件日志以获取错误详细信息。





i真的不知道如何解决它但在web.config文件中我声明了sql db以及关于数据库的所有内容如下所示



 <! -     WebConfigCod    - >   

< < span class =code-leadattribute> connectionStrings >
< add name = DatabaseConnectionString1 connectionString = 数据源=(LocalDB)\ v11.0 ; AttachDbFilename = | DataDirectory | \Database.mdf; Integrated Security = True

< span class =code-attribute> providerName = System.Data.SqlClient / >
< / connectionStrings >

<! - WebConfigCode - >





我的尝试:



i尝试使用ip端口而不是命名实例,但我不知道该怎么做

解决方案

错误信息非常明确!

< pre lang =text>找不到服务器或无法访问服务器。验证实例名称是否正确以及SQL Server是否配置为允许远程连接。

这意味着它所说的:您尝试访问的SQL服务器 - 本地数据库 - 未安装或是没有运行。



网站的SQL服务器实例不太可能是LOCALDB - 它通常是一个命名实例,它几乎肯定不会使用集成安全性,特别是在共享主机服务上。还要记住,IIS不能在您的用户帐户下运行,因此SQL需要配置为使用它。



首先查看来自您的数据库信息提供商,然后尝试这个:创建简单的SQL连接字符串 [ ^ ]



哦,顺便说一句......附加数据库仅用于开发,它只适用于SQL Express,不能用于生产。将其添加到IIS用户问题,您可能会在尝试为您的网站附加数据库时出现访问冲突错误。数据库应该安装到SQL中并直接使用,而不是附加。


hi all
i have a asp.net website that i want to run on iis
but when i cick on browse in iis manager
i get this error in index.aspx page

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



i really dont know how to solve it but in web.config file i declare the sql db and everything about database like below

<!-- WebConfigCod -->

      <connectionStrings>
        <add name="DatabaseConnectionString1" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True"

          providerName="System.Data.SqlClient" />
      </connectionStrings>

<!-- WebConfigCode -->



What I have tried:

i tried to use ip port instead of named instance but i dont know how to do it

解决方案

The error message is pretty explicit!

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.

And it means what it says: the SQL server you are trying to access - a local DB - is not installed or is not running.

It's unlikely that an SQL server instance for a website will be LOCALDB - it's normally a named instance, and it almost certainly won't use integrated security, particularly on a shared hosting service. Also remember that IIS doesn't run under your user account, so SQL need to be configured to work with it.

So start by looking at your DB information from your provider, and then try this: Simple SQL Connection String Creation[^]

Oh, and by the way ... attaching a DB is only for development, it only works on SQL Express and can't be used in production. Add that to the IIS user problem and you would probably get "Access violation" errors trying to attach the DB for your website anyway. The DB should be installed into SQL and used directly, not attached.


这篇关于网络相关的SQL服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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