【发布时间】:2017-06-15 13:28:08
【问题描述】:
我使用 Web Jobs 在后台连续运行我的功能,它在本地机器和 azure 中运行良好。但随机这个网络作业会失败,并给出如下所示的错误。
Microsoft.Azure.WebJobs.Host.FunctionInvocationException:执行函数时出现异常:Functions.ImportVehicles ---> System.Data.SqlClient.SqlException:建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供者:命名管道提供者,错误:40 - 无法打开与 SQL Server 的连接)---> System.ComponentModel.Win32Exception:系统找不到指定的文件---内部异常堆栈跟踪结束---在System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,SqlConnectionString connectionOptions,SqlCredential credential,Object providerInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions,SessionData reconnectSessionData,DbConnectionPool 池,String accessToken,Boolean applyTransientFaultHandling)。 Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions 选项,DbConnectionPoolKey poolKey,对象 poolGroupProviderInfo,DbConnectionPool 池,DbConnection owningConnection,DbConnectionOptions userOptions)在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool 池,DbConnection owningObject,DbConne ctionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at
上述异常是随机发生的,无法每次都获取/重现。
我知道该错误似乎表明这是 Azure 和 SQL 之间的临时连接问题。但是,我已将数据上下文配置为使用 SqlAzureExecutionStrategy,它应该处理断开的连接。
【问题讨论】:
-
听起来像是某种连接问题。你能看到它是否从 Kudu 控制台复制吗?见this page。
标签: azure azure-webjobs