2016-07-11 1 views
0

시간이 오래가는 저장 프로 시저를 호출하는 Webjob이 있습니다. 아무도 도와 줄 수 있습니까? 아래 도시Azure - 저장 프로 시저를 호출 할 때 WebJob 시간 초과가 발생했습니다.

static void Main() 
    { 
     ApplicationDbContext context = new ApplicationDbContext(); 

     context.Database.CommandTimeout = 6000; 

     context.PopulateJobTypeDescendants(); 

    } 

컨텍스트 (ApplicationDbContext)에있어서 :

웹 작업은 다음과 같은 코드를 사용하여 호출

public void PopulateJobTypeDescendants() 
    { 
     Database.ExecuteSqlCommand("PopulateJobTypeDescendants"); 
    } 

다음의 예외가 발생 웹 작업 때 운영. 우리는 이것이 서버의 DTU/계획과 관련 될 수 있음을 읽었으므로 S1 -> S3에서 진행되었지만 여전히 문제를 해결하지 못했고 프로세스가 45 초 후에 폭탄을 터뜨렸습니다. 이상한 것은 SSMS에서 Azure SQL DB에 연결하고 저장 프로 시저를 호출하면 정상적으로 작동한다는 것입니다.

는 [2016년 7월 11일 22시 25분 2초> e2cf50 : ERR]되지 않은 예외 : System.Data.SqlClient.SqlException : 제한 시간이 만료. 작업이 완료되기 전에 시간 만료 시간이 경과하거나 서버가 응답하지 않습니다. 라우팅 대상을 에 연결하려고 시도하는 동안이 오류가 발생했습니다. 을 시도하는 동안 소요 된 기간이 원래 서버에 연결되었습니다. - [사전 로그인] 초기화 = 14; 핸드 셰이크 = 26; [로그인] 초기화 = 0; 인증 = 0; [사후 로그인] 완료 = 1; ---> System.ComponentModel.Win32Exception : 대기 작업은

시간 초과 연결 문자열은 다음과 같습니다

<add name="TempsContext" connectionString="Server=tcp:[XXX],1433;Database=temps_testing;User ID=[XXX];Password=[XXX];Trusted_Connection=False;Encrypt=True;Connection Timeout=600;" providerName="System.Data.SqlClient" /> 

답변

0

는 실제로는 성능 문제처럼 보인다. 당신은 서버, 데이터베이스 이름 세부 정보 및 예외의 전체 호출 스택과 함께 com.com micrososft에서 mihaelab에서 나를 회신 해 주실 수 있습니까?

감사 미하엘

0

이는 EF 이것은 예컨대 자신이 생성 한 명령에 CommandTimeout 값을 전달하는 방법에 약간의 불일치에 기인하는 것으로 보인다 데이터베이스 초기화를 수행하거나 서버에서 버전 정보를 얻으십시오.

이를 추적하는 https://github.com/aspnet/EntityFramework6/issues/24에서 해결 방법, 예컨대 :

using System.Data.Common; 
using System.Data.Entity; 
using System.Data.Entity.Infrastructure.Interception; 

namespace CommandTimeOutBug 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      DbInterception.Add(new MyInterceptor()); 

      using (var context = new ApplicationDbContext()) 
      { 

       context.Database.CommandTimeout = 6000; 

       context.PopulateJobTypeDescendants(); 
      } 
     } 
    } 

    public class ApplicationDbContext : DbContext 
    { 

     public void PopulateJobTypeDescendants() 
     { 
      Database.ExecuteSqlCommand("PopulateJobTypeDescendants"); 
     } 
    } 

    public class MyInterceptor: DbCommandInterceptor 
    { 

     public override void NonQueryExecuting(DbCommand command, 
      DbCommandInterceptionContext<int> interceptionContext) 
     { 
      command.CommandTimeout = 6000; 
      base.NonQueryExecuting(command, interceptionContext); 
     } 

     public override void ReaderExecuting(DbCommand command, 
      DbCommandInterceptionContext<DbDataReader> interceptionContext) 
     { 
      command.CommandTimeout = 6000; 
      base.ReaderExecuting(command, interceptionContext); 
     } 

     public override void ScalarExecuting(DbCommand command, 
      DbCommandInterceptionContext<object> interceptionContext) 
     { 
      command.CommandTimeout = 6000; 
      base.ScalarExecuting(command, interceptionContext); 
     } 
    } 
} 

내가 버그를 만들었습니다으로 명령 차단을 사용할 수 있어야한다.

관련 문제