简体   繁体   English

System.ComponentModel.Win32Exception:等待操作从Azure VPN超时

[英]System.ComponentModel.Win32Exception: The wait operation timed out from Azure VPN

在此处输入图片说明 We have a Azure app service which tries to connect to on premise SQL server using VPN classic(configured using VNET). 我们有一个Azure应用服务,该服务尝试使用VPN classic(使用VNET配置)连接到内部SQL Server。

Occasionaly we get the following error : 有时我们会出现以下错误:

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. System.Data.SqlClient.SqlException(0x80131904):建立与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 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out (提供者:TCP提供程序,错误:0-等待操作超时。)---> System.ComponentModel.Win32Exception(0x80004005):等待操作超时

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) 在System.Data.SqlClient.SqlInternalConnectionTds..ctor处(DbConnectionPoolIdentity身份,SqlConnectionString connectionOptions,SqlCredential凭据,对象providerInfo,字符串newPassword,SecureString newSecurePassword,布尔型redirectedUserInstance,SqlConnectionString userConnectionOptions,SessionData reconnectSessionData,DbConnectionFaultHandle,ApplyInfo,String accessToken

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) 在System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,DbConnectionPoolKey poolKey,对象poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection,DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) 在System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池,DbConnection owningObject,DbConnectionOptions选项,DbConnectionPoolKey poolKey,DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 在System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) 在System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection)

at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) 在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,布尔值allowCreate,仅布尔值OneCheckConnection,DbConnectionOptions userOptions,DbConnectionInternal&连接)

at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) 在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource`1重试,DbConnectionOptions userOptions,DbConnectionInternal&连接)

at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) 在System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource`1重试,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal&连接)

at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal处(DbConnection externalConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions userOptions)

at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) 在System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection externalConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions userOptions)

at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 在System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1重试)

at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 在System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)

at System.Data.SqlClient.SqlConnection.Open() 在System.Data.SqlClient.SqlConnection.Open()

at Dapper.SqlMapper.d__11`1.MoveNext() 在Dapper.SqlMapper.d__11`1.MoveNext()

at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection) 在System.Collections.Generic.List 1..ctor(IEnumerable 1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) 在System.Linq.Enumerable.ToList [TSource](IEnumerable`1源)处

at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable 1 commandTimeout, Nullable 1 commandType) 在Dapper.SqlMapper.Query [T](IDbConnection cnn,字符串sql,对象参数,IDbTransaction事务,布尔型缓冲,可空1 commandTimeout, Nullable 1 commandType)

at SiSystems.ClientApp.Web.Domain.Repositories.UserRepository.FindByPrimaryEmail(String username) 在SiSystems.ClientApp.Web.Domain.Repositories.UserRepository.FindByPrimaryEmail(字符串用户名)

at SiSystems.ClientApp.Web.Domain.Repositories.UserRepository.FindByName(String username) 在SiSystems.ClientApp.Web.Domain.Repositories.UserRepository.FindByName(字符串用户名)

at SiSystems.ClientApp.Web.Auth.UserStore.<>c__DisplayClass3_0.b__0() 在SiSystems.ClientApp.Web.Auth.UserStore。<> c__DisplayClass3_0.b__0()

at System.Threading.Tasks.Task`1.InnerInvoke() 在System.Threading.Tasks.Task`1.InnerInvoke()

at System.Threading.Tasks.Task.Execute() 在System.Threading.Tasks.Task.Execute()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter`1.GetResult() 在Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter`1.GetResult()

at Microsoft.AspNet.Identity.UserManager`2.d__12.MoveNext() 在Microsoft.AspNet.Identity.UserManager`2.d__12.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at SiSystems.ClientApp.Web.Auth.ApplicationOAuthProvider.d__2.MoveNext() 在SiSystems.ClientApp.Web.Auth.ApplicationOAuthProvider.d__2.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__3f.MoveNext() 在Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__3f.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)

at Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__22.MoveNext() 在Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__22.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)

at Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__0.MoveNext() 在Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext() 在Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext() 在Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext() 在Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.d__0.MoveNext() 在Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.d__0.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext() 在Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext() 在Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.d__2.MoveNext()

--- End of stack trace from previous location where exception was thrown --- ---从之前引发异常的位置开始的堆栈结束跟踪---

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) 在Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)

at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) 在Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)

at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) 在System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep步骤)

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值和完成同步)

ClientConnectionId:00000000-0000-0000-0000-000000000000 ClientConnectionId:00000000-0000-0000-0000-000000000000

Error Number:258,State:0,Class:20 错误号:258,状态:0,类:20

added the image of the log which i got from azure 添加了我从天蓝色得到的日志的图像

1- This could be caused when the tcp protocol is not specified on the db-server-name in the connection string within your application. 1-这可能是由于在应用程序内的连接字符串中的db-server-name上未指定tcp协议引起的。

second possibility: 第二种可能性:

2- go to Sql Server Configuration management->SQL Server network config->protocols for 'servername' and check named pipes is enabled. 2-转到“服务器名”的“ SQL Server配置管理”->“ SQL Server网络配置”->“协议”,并检查已启用命名管道。

3- Firewall rules: 3-防火墙规则:

A port exception for TCP Port 1433. In the New Inbound Rule Wizard dialog, use the following information to create a port exception: Select Port Select TCP and specify port 1433 Allow the connection Choose all three profiles (Domain, Private & Public) Name the rule “SQL – TCP 1433″ A port exception for UDP Port 1434. Click New Rule again and use the following information to create another port exception: Select Port Select UDP and specify port 1434 Allow the connection Choose all three profiles (Domain, Private & Public) Name the rule “SQL – UDP 1434 A program exception for sqlservr.exe. TCP端口1433的端口例外。在“新建入站规则向导”对话框中,使用以下信息创建端口例外:选择端口选择TCP并指定端口1433允许连接选择所有三个配置文件(域,专用和公用)。规则“ SQL – TCP 1433” UDP端口1434的端口例外。再次单击“新建规则”,并使用以下信息创建另一个端口例外:选择端口选择UDP并指定端口1434允许连接选择所有三个配置文件(域,专用和公用)将规则命名为“ SQL – UDP 1434 sqlservr.exe的程序异常。 Click New Rule again and use the following information to create a program exception: Select Program Click Browse to select 'sqlservr.exe' at this location: [C:\\Program Files\\Microsoft SQL Server\\MSSQL11.\\MSSQL\\Binn\\sqlservr.exe] where is the name of your SQL instance. 再次单击“新建规则”,然后使用以下信息创建程序例外:选择“程序”,然后单击“浏览”以在以下位置选择“ sqlservr.exe”:[C:\\ Program Files \\ Microsoft SQL Server \\ MSSQL11。\\ MSSQL \\ Binn \\ sqlservr。 exe]其中是您的SQL实例的名称。 Allow the connection Choose all three profiles (Domain, Private & Public) Name the rule SQL – sqlservr.exe A program exception for sqlbrowser.exe Click New Rule again and use the following information to create another program exception: Select Program Click Browse to select sqlbrowser.exe at this location: [C:\\Program Files\\Microsoft SQL Server\\90\\Shared\\sqlbrowser.exe]. 允许连接选择所有三个配置文件(域,专用和公用)将规则命名为SQL – sqlservr.exe sqlbrowser.exe的程序异常再次单击“新建规则”,然后使用以下信息创建另一个程序异常:选择程序单击“浏览”以选择sqlbrowser.exe在以下位置:[C:\\ Program Files \\ Microsoft SQL Server \\ 90 \\ Shared \\ sqlbrowser.exe]。 Allow the connection Choose all three profiles (Domain, Private & Public) Name the rule SQL - sqlbrowser.exe 允许连接选择所有三个配置文件(域,专用和公用)将规则命名为SQL-sqlbrowser.exe

Refer to: SQL Connection Error: System.Data.SqlClient.SqlException (0x80131904) and also: https://thycotic.force.com/support/s/article/System-Data-SqlClient-SqlException-0x80131904 请参阅: SQL连接错误:System.Data.SqlClient.SqlException(0x80131904)以及: https : //thycotic.force.com/support/s/article/System-Data-SqlClient-SqlException-0x80131904

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

相关问题 简单更新查询导致 System.ComponentModel.Win32Exception: The wait operation timed out error in C# 和 SQL 服务器 - Simple update query caused System.ComponentModel.Win32Exception: The wait operation timed out error in C# and SQL Server System.ComponentModel.Win32Exception:操作成功完成 - System.ComponentModel.Win32Exception: The operation completed successfully System.ComponentModel.Win32Exception:操作成功完成 - System.ComponentModel.Win32Exception: The Operation Complected successfully 调试单元测试时,“ System.ComponentModel.Win32Exception:操作成功完成” - 'System.ComponentModel.Win32Exception: The operation completed successfully' while debugging unit test System.ComponentModel.Win32Exception:“拒绝访问” - System.ComponentModel.Win32Exception: „Acces is denied” System.ComponentModel.Win32Exception:访问被拒绝 - System.ComponentModel.Win32Exception : Access is denied 为什么hasExited抛出&#39;System.ComponentModel.Win32Exception&#39;? - Why did hasExited throw 'System.ComponentModel.Win32Exception'? System.ComponentModel.Win32Exception:找不到路径 - System.ComponentModel.Win32Exception: Path not found System.ComponentModel.Win32Exception c# - System.ComponentModel.Win32Exception c# System.ComponentModel.Win32Exception:访问被拒绝...错误 - System.ComponentModel.Win32Exception: Access is denied… Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM