本文介绍了Azure数据库连接错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友你好,

我是新来的Azure。并且仍然在学习所有内部的事情。我试图连接数据库并获得例外下文。任何指针将是非常美联社preciated?

我不知道是否有人曾经经历过这样或会是什么原因呢?
连接DB:

  System.Data.SqlClient.SqlException是由用户code未处理
      的HResult = -2146232060
      消息=无法打开服务器上XXXX所要求的登录。 IP地址为XX.XX.XX.XX不允许客户端访问服务器。要允许访问,请使用Windows Azure管理门户或主数据库上运行sp_set_firewall_rule创建此IP地址或地址范围内的防火墙规则。这可能需要长达五分钟,此更改生效。
    用户登录失败用户。
    本次会议已分配'bf7474de-2a5a-4ce2-a8fb-7d3cc57a473b的追踪ID。需要帮助时提供此跟踪的ID的客户支持。
      来源= .net SqlClient数据提供
      错误code = -2146232060
      CLASS = 16
      行号= 65536
      数= 40615
      过程=
      服务器= LT;服务器名称>
      状态= 1

连接到数据库:
 堆栈跟踪:

 在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,UInt32的waitForMultipleObjectsTimeout,布尔allowCreate,布尔onlyOneCheckConnection,DbConnectionOptions USEROPTIONS,DbConnectionInternal&安培;连接)
           在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,TaskCompletionSource`1重试,DbConnectionOptions USEROPTIONS,DbConnectionInternal&安培;连接)
           在System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(的DbConnection owningConnection,TaskCompletionSource`1重试,DbConnectionOptions USEROPTIONS,DbConnectionInternal oldConnection,DbConnectionInternal&安培;连接)
           在System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(的DbConnection outerConnection,DbConnectionFactory connectionFactory的,TaskCompletionSource`1重试,DbConnectionOptions USEROPTIONS)
           在System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory的,TaskCompletionSource`1重试,DbConnectionOptions USEROPTIONS)
           在System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1重试)
           在System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)
           在System.Data.SqlClient.SqlConnection.Open()
           在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher<开和GT; b__38(的DbConnection T,DbConnectionInterceptionContext C)
           在System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget目标,Action`2操作,TInterceptionContext interceptionContext,Action`3执行,执行Action`3)
           在System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(连接的DbConnection,DbInterceptionContext interceptionContext)


解决方案

有IP限制访问Azure数据库。

1.You需要您的添加到在Azure管理门户所允许的IP地址。

You可以从这里answe。

Hello Friends,

I'm new to Azure. and still learning all internal things. I'm trying to connect a DB and getting below exception. Any pointers will be very appreciated?

I wonder if anyone has ever experienced this or what would be the reason?Connecting to DB:

 System.Data.SqlClient.SqlException was unhandled by user code
      HResult=-2146232060
      Message=Cannot open server 'XXXX' requested by the login. Client with IP address 'XX.XX.XX.XX' is not allowed to access the server.  To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.
    Login failed for user 'User'.
    This session has been assigned a tracing ID of 'bf7474de-2a5a-4ce2-a8fb-7d3cc57a473b'.  Provide this tracing ID to customer support when you need assistance.
      Source=.Net SqlClient Data Provider
      ErrorCode=-2146232060
      Class=16
      LineNumber=65536
      Number=40615
      Procedure=""
      Server=<SERVER NAME>
      State=1

Connecting to DB: StackTrace:

  at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
           at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
           at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
           at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
           at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
           at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
           at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
           at System.Data.SqlClient.SqlConnection.Open()
           at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__38(DbConnection t, DbConnectionInterceptionContext c)
           at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
           at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
解决方案

There is IP restriction for accessing Azure Database.

1.You need to add your Public IP to the allowed Ip address on the Azure ManageMent Portal.

You can get the answe from here.

这篇关于Azure数据库连接错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 22:48