Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure database connection error. [duplicate]

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)
like image 302
user1142067 Avatar asked Jun 06 '14 06:06

user1142067


1 Answers

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. enter image description here

like image 154
sudhAnsu63 Avatar answered Sep 20 '22 05:09

sudhAnsu63