1

아래 오류가 자주 발생합니다. 나는 누군가가 이것을 경험했는지 또는 그 이유가 무엇인지 궁금합니다.SQL Azure 데이터베이스에 연결하는 중 오류가 발생했습니다.

저는 Entity Framework 4.0 및. NET 4.0 및 Visual Studio 2010 및 Windows Azure SDK 1.7 및 2.0.

<add name="MyEntities" 
    connectionString="metadata=res://*/Model.ModelMy.csdl|res://*/Model.ModelMy.ssdl|res://*/Model.ModelMy.msl; 
     provider=System.Data.SqlClient; 
     provider connection string=&quot; 
     data source=myserver.database.windows.net; 
     initial catalog=MyDatabase; 
     persist security info=True; 
     user id=myUser; 
     password=myPassword; 
     multipleactiveresultsets=True; 
     Trusted_Connection=False; 
     Encrypt=True; 
     Connection Timeout=30; 
     App=EntityFramework&quot;" 
    providerName="System.Data.EntityClient" 
/> 

오류 정보 :

Server Error in '/' Application. 

Database 'MyDatabase' on server '[NAMEMYSERVER]' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'efb529ba-14eb-46d0-8311-d48b03435cee'. 
Login failed for user 'myUser'. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Database 'MyDatabase' on server '[NAMEMYSERVER]' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'efb529ba-14eb-46d0-8311-d48b03435cee'. 
Login failed for user 'myUser'. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[SqlException (0x80131904): Database 'MyDatabase' on server '[NAMEMYSERVER]' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'efb529ba-14eb-46d0-8311-d48b03435cee'. 
Login failed for user 'myUser'.] 
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +706 
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89 
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6425518 
    System.Data.SqlClient.SqlConnection.Open() +300 
    System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67 

[EntityException: The underlying provider failed on Open.] 
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4728195 
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725 
    MyProjectRules.Negocio.MyDatabaseHotel.HotelRN.PesquisarTodos(Include include) +0 
    MyProjectWebRole.MyDatabaseHotel.Views.ListaHoteis.CarregarGridViewEntidade() +183 
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 
    System.Web.UI.Control.LoadRecursive() +71 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.551 

답변

1

1 단계 : 연결 문자열을 단순화

다음은 연결 문자열입니다. 우리는 다음과 같습니다 : 그래서 연결 문자열을보고

<add name="[CONTEXTNAME]" 
    providerName="System.Data.SqlClient" 
    connectionString=" 
     Server=tcp:[SERVER].database.windows.net,1433; 
      Database=[DATABASE]; 
      User ID=[USER]@[SERVER]; 
      Password=[PASSWORD]; 
      Trusted_Connection=False; 
      Encrypt=True; 
      Connection Timeout=30;"/> 

, 내가 좋아하는 뭔가를 시도 할 것입니다 :

<add name="MyEntities" 
    providerName="System.Data.SqlClient" 
    connectionString=" 
      metadata=res://*/Model.ModelMy.csdl|res://*/Model.ModelMy.ssdl|res://*/Model.ModelMy.msl; 
      Server=myserver.database.windows.net; 
      Database=MyDatabase; 
      User [email protected]; 
      Password=myPassword; 
      Multipleactiveresultsets=True; 
      Trusted_Connection=False; 
      Encrypt=True; 
      Connection Timeout=30; 
      App=EntityFramework;" /> 

2 단계 : 당신은 "사용자 ID가"서버 이름을없는 것 같습니다. myUser @ myServer 여야합니다. 다시 입력 해보십시오.

3 단계 : 아마도 중요하지 않지만 서버 주소에서 ", 1433"이 누락되었습니다.

관련 문제