什么"当前命令发生了严重错误。结果,如果有的话,应丢弃&QUOT。 SQL Azure的错误是什么意思?的话、错误、发生了、命令

2023-09-03 04:02:33 作者:太阳好冷i

有一次,我的code相遇

Once in a while my code encounters

System.Data.SqlClient.SqlException
The service has encountered an error processing your request. Please try again.
Error code 40540. A severe error occurred on the current command.
The results, if any, should be discarded.
Class 20
Number 40197

这很少发生,一般消失在一两分钟,我不能可靠地重现。有时错误code 可以是一个数字比 40540 等。

that happens very rarely, usually goes away in a minute or two and I can't reliably reproduce it. Sometimes Error code can be a number other than 40540.

我GOOGLE了一下,看起来像它通常是由在SQL Server错误引发的,是重复的。

I've Googled a bit and looks like it's usually triggered by bugs in SQL Server and is reproducible.

我有两个选择 - 重试查询或把它当作致命的,打破坚硬。我想preFER有更好的理解什么问题实际上是和我是否安全的重试查询。

I have two options - retry the query or treat it as fatal and break hard. I'd prefer to have better understanding what the problem actually is and whether I'm safe retrying the query.

我重试查询时出现此错误?

Do I retry the query when this error occurs?

推荐答案

一个快速谷歌搜索给了我这个。

A quick google search gave me this.

服务遇到一个错误处理您的请求。请再试一次。错误code%D。您将收到此错误,当服务出现故障,由于软件或硬件升级,硬件故障,或任何其他的故障转移问题。重新连接到您的SQL数据库服务器会自动连接到你的数据库的一个健康的副本。您可能会看到错误codeS 40143和40166嵌入式错误40540.的消息的错误codeS 40143和40166提供有关发生的一种故障的附加信息中。不要修改应用程序捕捉错误codeS 40143和40166.您的应用程序应该捕获40540,并尝试重新连接到SQL数据库中,直到资源可用,你的连接被重新建立。

The service has encountered an error processing your request. Please try again. Error code %d. You will receive this error, when the service is down due to software or hardware upgrades, hardware failures, or any other failover problems. Reconnecting to your SQL Database server will automatically connect you to a healthy copy of your database. You may see error codes 40143 and 40166 embedded within the message of error 40540. The error codes 40143 and 40166 provide additional information about the kind of failover that occurred. Do not modify your application to catch error codes 40143 and 40166. Your application should catch 40540 and try reconnecting to SQL Database until the resources are available and your connection is established again.

您可以访问这里以获取更多信息。它说的您的应用程序应该捕获40540,并尝试重新连接到SQL数据库中,直到资源可用,你的连接被重新建立。的

You can visit here for more information. It says Your application should catch 40540 and try reconnecting to SQL Database until the resources are available and your connection is established again.

虽然就我个人而言,我建议不要使用SQL Azure的,因为它扼杀容易,你无法控制分配给你的资源。我所做的就是要在Azure虚拟机上安装SQL Server和使用,在我的应用程序。

Though on a personal note I would suggest not to use Sql azure as it throttles easily and you can't control the resources allocated to you. What I did was to install sql server on azure vm and use that in my application.

希望这有助于你。