SQL Microsoft Azure 中的连接错误
SQL Connection Errors in Microsoft Azure
我们在 Web API 2.0 代码中实现了 entity framework。要调用数据库实体,我们使用存储过程调用。我们的整个应用程序托管在 Microsoft Azure 云中。这是我们面临的两个例外。
Message : An error occurred while executing the command definition. See the inner exception for details.
InnerException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. This failure occured while attempting to connect to the Principle server.
我们面临的另一个例外是:
Message : The underlying provider failed on Open.
InnerException: The connection was not closed. The connection's current state is connecting.
注意:代码在 C# Web API 2.0 中。我们正在使用 Entity Framework 调用存储过程。数据库位于 SQL Server 2012。在 web.config 中,连接字符串如下所示:
<add name="*****Entities" connectionString="metadata=res://*/Models.Database.*****.csdl|res://*/Models.Database.*****.ssdl|res://*/Models.Database.*****.msl;provider=System.Data.SqlClient;provider connection string="data source=*****;Failover Partner=*****;initial catalog=*****;user id=*****;password=********;MultipleActiveResultSets=True;Pooling=false;Connection Lifetime=2;App=EntityFramework"" providerName="System.Data.EntityClient" />
此外,此错误不是连续的,我们猜测这可能是网络问题或流量过大时发生的。但我们对此仍然没有任何确定的理由。
请指导我们解决同样的问题。
我觉得这像是瞬态故障错误。
您应该使用 EF6(或更高版本)和 setup the Execution Strategies.
我们在 Web API 2.0 代码中实现了 entity framework。要调用数据库实体,我们使用存储过程调用。我们的整个应用程序托管在 Microsoft Azure 云中。这是我们面临的两个例外。
Message : An error occurred while executing the command definition. See the inner exception for details.
InnerException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. This failure occured while attempting to connect to the Principle server.
我们面临的另一个例外是:
Message : The underlying provider failed on Open.
InnerException: The connection was not closed. The connection's current state is connecting.
注意:代码在 C# Web API 2.0 中。我们正在使用 Entity Framework 调用存储过程。数据库位于 SQL Server 2012。在 web.config 中,连接字符串如下所示:
<add name="*****Entities" connectionString="metadata=res://*/Models.Database.*****.csdl|res://*/Models.Database.*****.ssdl|res://*/Models.Database.*****.msl;provider=System.Data.SqlClient;provider connection string="data source=*****;Failover Partner=*****;initial catalog=*****;user id=*****;password=********;MultipleActiveResultSets=True;Pooling=false;Connection Lifetime=2;App=EntityFramework"" providerName="System.Data.EntityClient" />
此外,此错误不是连续的,我们猜测这可能是网络问题或流量过大时发生的。但我们对此仍然没有任何确定的理由。
请指导我们解决同样的问题。
我觉得这像是瞬态故障错误。 您应该使用 EF6(或更高版本)和 setup the Execution Strategies.