2012-12-17 4 views
2

여러분!connection_instance.Open() 명령의 시간 제한을 변경하는 방법은 무엇입니까?

저는 Entity Framework (실제로는 중요하지 않습니다)와 여러 데이터베이스 (ObjectContexts)와 함께 작업하고 있습니다. SQL Server 중 하나에는 선택적인 추가 데이터가 있으며, 때때로 오프라인 일 수 있습니다.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

것은 어떻게 든이를 변경할 수 : 오프라인 경우 서버, 나는 나에게 예외를 제공 connection_instance.Open() 명령을 운영에 60 초 기다려야 할 때

나는 모든 명령에서 예외를 처리하기 위해 노력하고있어 때 60 초에서 다른 값의 5 초까지 시간 초과? 그건 그렇고, 내 엔티티 프레임 워크의 시간 제한 연결은 2 초이지만 무시됩니다.

이 시간 초과가 전체 시스템에 설정되어있는 것 같습니다 (Windows 등록시). 나는 SQL Management Studio를 통해이 SQL 서버에 연결하려고 시도했으며 60 초를 연결하려고 시도했다가 동일한 예외가 발생했습니다.

그래서이 시간 초과 값을 변경할 수있는 방법이 있습니까? 또는 sqlserver 상태를 확인하는 또 다른 빠른 방법은 무엇입니까?

+0

합니까 ObjectContext.CommandTimeout이 문서가 작동

봐? ///

/// 모든 개체 컨텍스트 작업의 제한 시간 (초)을 가져 오거나 설정합니다. null 값은 기본 공급자의 기본값이 사용됨을 나타냅니다. /// /// /// /// 시간 제한 값인 값 (초). /// /// <예외 cref = "T : System.ArgumentException"> 제한 시간 값이 0보다 작습니다. public int? CommandTimeout –

답변

0

ObjectContext.CommandTimeout이 작동합니까?

/// <summary> 
/// Gets or sets the timeout value, in seconds, for all object context operations. A null value indicates that the default value of the underlying provider will be used. 
/// </summary> 
/// 
/// <returns> 
/// An <see cref="T:System.Int32"/> value that is the timeout value, in seconds. 
/// </returns> 
/// <exception cref="T:System.ArgumentException">The timeout value is less than 0. </exception> 
public int? CommandTimeout 
+0

불행히도, 아니요. – DanTheMan

관련 문제