简体   繁体   English

SQL Azure连接突然失败

[英]SQL Azure connectivity fails all of a sudden

I have a website hosted on GoDaddy server and many users access this website with their respective username and passwords. 我在GoDaddy服务器上托管了一个网站,许多用户使用各自的用户名和密码访问该网站。 My database is in Azure. 我的数据库在Azure中。 All of a sudden when the users of this website try to access the website with their username and password they fail to be identified as valid users though they are valid. 突然,当该网站的用户尝试使用其用户名和密码访问该网站时,尽管他们是有效的,但仍无法被识别为有效用户。

consequently when such a thing happens almost for more than 5 mins no user can login to the website. 因此,当这种情况发生的时间几乎超过5分钟时,没有用户可以登录该网站。 but i can very well connect to the database from my local server or through the azure portal. 但是我可以很好地从本地服务器或通过azure门户连接到数据库。

the series of errors that gets logged into event viewer are as follows: 登录事件查看器的一系列错误如下:

  1. System.Data.SqlClient.SqlException: Timeout expired. System.Data.SqlClient.SqlException:超时已过期。 The timeout period elapsed prior to completion of the operation or the server is not responding. 在操作完成之前超时或服务器没有响应。

  2. System.Data.SqlClient.SqlException: a transport-level error has occured when sending the request to the server.(provider:TCP provider,error:0 - An existing connection was forcibly closed by the remote host.) System.Data.SqlClient.SqlException:向服务器发送请求时发生传输级错误。(提供者:TCP提供者,错误:0-远程主机强行关闭了现有连接。)

  3. System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. System.Data.SqlClient.SqlException:建立与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. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (提供者:TCP提供程序,错误:0-连接尝试失败,因为一段时间后连接方未正确响应,或者连接建立因连接主机未能响应而失败。)

  4. SourceEdge.BCL.BCLException: Unable to Execute ---> System.Data.SqlClient.SqlException: Timeout expired. SourceEdge.BCL.BCLException:无法执行---> System.Data.SqlClient.SqlException:超时已过期。 The timeout period elapsed prior to completion of the operation or the server is not responding. 在操作完成之前超时或服务器没有响应。

  5. System.ArgumentNullException: Value cannot be null. System.ArgumentNullException:值不能为null。 Parameter name: connection 参数名称:连接

after the error shown in 5 occurs all the subsequent logins will result in invalid user though the values are not null. 在发生5中所示的错误后,所有后续登录将导致无效用户,尽管值不为null。

Can you tell me why this error happens all of a sudden. 你能告诉我为什么这个错误突然发生。 but it gets back to normal after a few minutes or even takes hours sometimes. 但几分钟后恢复正常,有时甚至需要几个小时。

I'm not sure if you're aware of some pitfalls regarding connection handling to SQL Azure. 我不确定您是否知道与SQL Azure的连接处理有关的一些陷阱。 The SQL Azure service might close connections at any time for some reasons. 由于某些原因,SQL Azure服务可能随时关闭连接。 What you need is so called Transient condition handling. 您需要的就是所谓的瞬时条件处理。 Not sure if this is the problem, but if you'are not aware of this, I'd suggest you read the following resources: 不知道这是否是问题,但是如果您不知道这一点,建议您阅读以下资源:

Microsoft Technet - Windows Azure SQL Database Connection Management Microsoft Technet-Windows Azure SQL数据库连接管理

Microsoft Technet - Retry Logic for Transient Failures in Windows Azure SQL Database Microsoft Technet-Windows Azure SQL数据库中的瞬时故障重试逻辑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM