无法从我的网站连接到SQL Server [英] can not connect to sql server from my website

查看:77
本文介绍了无法从我的网站连接到SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站,我有一个问题,当我将网站发布到我们的服务器(Windows服务器2012),我的网站正常工作,所有页面连接到SQL服务器并正确获取数据,但有时页面无法连接到SQL Server并收到错误
"建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。
(提供者:SQL网络接口,错误:26 - 错误定位指定的服务器/实例)"

i have a asp.net website and i have a problem that when i publish website to our server(windows server 2012),my website work correctly and all page connect to sql server and get data correctly but sometimes pages can't connect to sql server and get error "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)"

我从web.config中读取连接字符串,并在我们的服务器中安装了我的sql server

i read connection string from web.config and my sql server installed in our server

web.config中的连接字符串表达式:

my connection string expression in web.config :

< add name =" ConStrNet" connectionString =" Data Source = 172.27.15.188; Initial Catalog = my db; User ID = username; Password = password" />

<add name="ConStrNet" connectionString="Data Source=172.27.15.188;Initial Catalog=my db;User ID=username;Password=password"/>

very 奇怪的是,当我收到错误时,我打开我的项目的web.config并更改任何内容并保存web.config,我的错误解决和页面连接到sql server大约30分钟然后得到错误再次

veryStrange part is that when i get error, i open web.config of my project and change anything and save web.config,my error solve and page connect to sql server for about 30 minutes and then get error again

请帮助我

please help me

推荐答案

错误消息表示您无法联系您要连接的服务器。例如,这是你拉网线时得到的消息。

The error message means that you are not able to contact the server you want to connect to. For instance, this is the message you get if you pull the network cable.

我对ASP .NET知之甚少(这个论坛是关于使用.Net 内部 SQL Server),但是对于您的描述,听起来您在某种程度上毁坏了Web应用程序中的连接字符串。或者你简单地拥有一个片状的网络连接。
下次发生这种情况时,只需坐在你的手上几分钟,看看会发生什么。

I know very little about ASP .NET (this forum is about using .Net inside SQL Server), but for your description it sounds like you are somehow mutilating the connection string in side your web app. Or you simplly have a flaky network connection. Next time this happens, just sit on your hands for a few minutes to see what happens.


这篇关于无法从我的网站连接到SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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