2017-11-11 19 views
0

저는 C#에서 HangFire를 사용하여 Windows 서비스를 작성했습니다. 서비스 1은 다음과 같습니다C# Windows Service Hangfire 오류 : 1053 (데이터베이스에 연결하는 GlobalConfiguration)

public Service1() 
    { 
     InitializeComponent(); 
     GlobalConfiguration.Configuration.UseSqlServerStorage(@"Data Source=DESKTOP-B90D804\SQLEXPRESS;Initial Catalog=Leavingstone_Geocell_Students;Integrated Security=True"); 
    } 

    protected override void OnStart(string[] args) 
    { 
     File.Create(AppDomain.CurrentDomain.BaseDirectory + "OnStart5.txt"); 
     _server = new BackgroundJobServer(); 
    } 

    protected override void OnStop() 
    { 
     File.Create(AppDomain.CurrentDomain.BaseDirectory + "OnStop5.txt"); 
     _server.Dispose(); 
    } 

하지만 설치하려고 할 때 나는 Windows 서비스에서 오류 1053을 점점 계속. 서비스가시의 적절하게 시동 또는 제어 요청에 응답하지 않았다고 말합니다.

하지만 "GlobalConfiguration.Configuration.UseSqlServerStorage(@"Data Source=DESKTOP-B90D804\SQLEXPRESS;Initial Catalog=Leavingstone_Geocell_Students;Integrated Security=True");"을 제거하면 작동합니다.

또한 Visual Studio에서 디버그 모드로 실행하면 GlobalConfiguration 섹션을 제거하지 않고도 작동합니다. Windows 서비스는 로컬 시스템 계정을 사용합니다.

답변

0

NT AUTHORITY \ SYSTEM 사용자에게 sql 권한을 부여하고 문제를 해결했습니다.