asp.net MVC 페이지에서 작업 시간을 처리하는 방법에 대한 질문이 있습니다. 데이터베이스 SQL Server를 쿼리하는 페이지를로드하는 동안 제품을로드합니다. 그리고 언젠가는 기다리는 작업 시간을 알려줍니다. 그것을 다루는 방법.기다리는 작업 시간 초과 MVC
답변
매우 긴 쿼리를 실행할 때 대기 작업 시간 초과 예외를 피하려면 SQL 명령 속성을 변경하고 제한 시간을 호출하기 전에 명령이 더 오래 대기하도록하십시오.
using System;
using System.Data.SqlClient;
///
public class A {
///
public static void Main() {
string connectionString = "";
// Wait for 5 second delay in the command
string queryString = "waitfor delay '00:00:05'";
using (SqlConnection connection = new SqlConnection(connectionString)) {
connection.Open();
SqlCommand command = new SqlCommand(queryString, connection);
// Setting command timeout to 1 second
command.CommandTimeout = 1;
try {
command.ExecuteNonQuery();
}
catch (SqlException e) {
Console.WriteLine("Got expected SqlException due to command timeout ");
Console.WriteLine(e);
}
}
}
} SQL 쿼리에 Linq에의
실행는 &가의 DataContext 클래스의 CommandTimeout이 속성의 기본 값을 초과 시간이 오래 걸릴 수도 있습니다. 기본값은 30 초입니다. LINQ to SQL DataContext 개체를 만들고 쿼리를 호출 할 때마다 CommandTimeout 값을 설정할 수 있습니다.
#region Constructors
/// <summary>
/// Initializes a new FrameworkEntities object using the connection string found in the 'FrameworkEntities' section of the application configuration file.
/// </summary>
public FrameworkEntities() : base("name=FrameworkEntities", "FrameworkEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
this.CommandTimeout = 300;
OnContextCreated();
}
/// <summary>
/// Initialize a new FrameworkEntities object.
/// </summary>
public FrameworkEntities(string connectionString) : base(connectionString, "FrameworkEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
this.CommandTimeout = 300;
OnContextCreated();
}
/// <summary>
/// Initialize a new FrameworkEntities object.
/// </summary>
public FrameworkEntities(EntityConnection connection) : base(connection, "FrameworkEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
this.CommandTimeout = 300;
OnContextCreated();
}
#endregion
'command.CommandTimeout = 0 얼마나 많은 CPU,'무한 될 것인가? –
0은 무한 타임 아웃입니다. SQL SERVER 인스턴스의 응답이 두 개 이상의 네트워크 패킷으로 나눠지면 연결이 잘못 연결되어 일반 네트워크 오류가 발생합니다. – AnandMohanAwasthi
어디서나 그러한 문서를 찾을 수 없었습니다. 고마워. –
- 1. MongoConnection을 기다리는 시간 초과
- 2. .NET MVC 작업 중 시간 초과 이벤트
- 3. jboss에서 작업 시간 초과
- 4. asp.net의 시간 초과 작업
- 5. 작업 시간 초과 - ASP
- 6. TCP 작업 시간 초과
- 7. 유니콘 작업 시간 초과
- 8. async 작업 시간 초과
- 9. 대기 작업 시간 초과
- 10. 작업 시간 초과
- 11. openafs 작업 시간 초과
- 12. mvc 세션 시간 초과
- 13. 브라우저 비누 클라이언트를 기다리는 시간 초과
- 14. ConnectionPoolTimeoutException : 풀에서 연결을 기다리는 시간 초과.
- 15. org.apache.http.conn.ConnectionPoolTimeoutException : 풀에서 연결을 기다리는 시간 초과.
- 16. WebApi 비동기 작업 반환 시간 초과
- 17. 배포 오류 (작업 시간 초과)
- 18. SQL Server 작업 시간 초과
- 19. SmtpClient.send "작업 시간 초과 오류"
- 20. heroku - clone - 작업 시간 초과
- 21. Azure Scheduler 작업 시간 초과
- 22. FreeSwitch에서 시간 초과 후 작업
- 23. Boost.Asio : 비동기 작업 시간 초과
- 24. MVC 영구 쿠키 시간 초과?
- 25. asp.net mvc 세션 시간 초과
- 26. 세션 시간 초과 MVC 4
- 27. 컨트롤러 시간 초과 MVC 3.0
- 28. Selenium.click 작업 완료를 기다리는 시간 초과되었습니다.
- 29. ASP.NET MVC 컨트롤러 메서드 시간 초과
- 30. 대기 작업 시간 초과 Win32Exception (0x80004005) : 대기 작업 시간 초과 azure
검토 코드 .. 확인하여 SQL 쿼리, 그것은 복용과 자원이 .. –