我有一個發佈到Microsoft Azure的Web應用程序。有兩個數據庫,都在Azure中的SQL Server上託管。一個處理身份驗證的數據庫工作得很好,我可以很好地登錄/查看不涉及其他數據庫的頁面。當我嘗試執行訪問其他數據庫的操作時,我在該帖子的底部看到了錯誤。在Microsoft Azure Web應用程序中拒絕SQL Server的訪問
它必須是在Azure中的東西。當我在本地運行應用程序時,即使它仍在訪問相同的Azure託管數據庫,也能正常工作。這裏是連接字符串(我已經改變了一些敏感的信息),我使用的,再次,無論是在本地工作的罰款:
<connectionStrings>
<add name="IdentityConnection" connectionString="Server=tcp:{server}.database.windows.net,1433;Database=identity; ID={User};Password={pw};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
providerName="System.Data.SqlClient" />
<add name="DataConnection" connectionString="Server=tcp:{server}.database.windows.net,1433;Database=Data;User ID={User};Password={pw};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" />
訪問被拒絕
說明:未處理的異常發生在執行當前Web請求期間。請查看堆棧跟蹤以獲取有關該錯誤的更多信息以及源代碼的位置。
異常詳細信息:System.ComponentModel.Win32Exception:訪問被拒絕
源錯誤:
在當前web請求的執行過程中生成未處理的異常。關於異常的來源和位置的信息可以使用下面的異常堆棧跟蹤來標識。
堆棧跟蹤:
[Win32Exception(0X80004005):訪問被拒絕]
[SQLEXCEPTION(0x80131904):在與SQL Server建立連接時出現與網絡相關的或特定於實例的錯誤。服務器未找到或無法訪問。驗證實例名稱是否正確,並將SQL Server配置爲允許遠程連接。 (提供程序:命名管道提供程序,錯誤:40 - 無法打開連接到SQL Server)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException異常,布爾breakConnection,操作1 wrapCloseInAction) +5341687 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5353471 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +923 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +311 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +646 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1重試,DbConnectionOptions userOptions,DbConnectionInternal &連接) 78 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(的DbConnection owningConnection,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1重試,DbConnectionOptions USEROPTIONS)146 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory的,TaskCompletionSource 1 retry, DbConnectionOptions userOptions) +16 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
1重試)94 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)+110 System.Data.SqlClient.SqlConnect ion.Open()+96 License_Project_Web.View_Licenses.Page_Load(Object sender,EventArgs e)+43 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,EventArgs e)+51 System.Web.UI.Control。的OnLoad(EventArgs的)92 System.Web.UI.Control.LoadRecursive()54 System.Web.UI.Page.ProcessRequestMain(布爾includeStagesBeforeAsyncPoint,布爾includeStagesAfterAsyncPoint)772
是的,已經啓用。 給我提供錯誤的數據庫是在本地服務器上創建的,然後我將.BACPAC導出到Azure存儲。如果原始本地服務器使用Windows身份驗證,可能以某種方式反映在數據庫中並導致拒絕訪問? – 2014-09-03 21:07:07