2012-05-10 4 views
0

SharePoint 기초를 사용하고 있습니다. 일부 OCR 프로세스를 실행하는 데 사용되는 콘솔 응용 프로그램이 있습니다. Windows 서비스에서 콘솔 응용 프로그램의 exe 호출하고 잘 작동하고 있습니다. 이벤트 수신기에서 동일한 exe를 호출하려고하지만 exe를 호출 할 수없고 오류가 발생하지 않습니다. 이벤트 수신기는 정상적으로 작동하지만 exe를 호출 할 수 없습니다. notepad.exe 같은 다른 exes를 호출하려고했지만 동일한 오류가 발생했습니다. 세부 사항은 다음과 같습니다 :이벤트 수신기에서 콘솔 응용 프로그램 (.exe) 호출 및 오류 발생

코드 : 아래

public override void ItemAdded(SPItemEventProperties properties) 
{ 

    try 
    { 
     base.ItemAdded(properties); 
     Log("Event Occured."); 
     string OCRedText = string.Empty; 
     string Listname = properties.ListTitle; 
     string itemName = Convert.ToString(properties.ListItem["Name"]); 
     string itemTitle = Convert.ToString(properties.ListItem["Title"]); 

     callService(); // Here is the method to call Process     

     SPListItem item = properties.ListItem; 
     if (System.Threading.Monitor.TryEnter(myLock, TimeSpan.FromSeconds(100))) 
     { 
      if (Convert.ToString(item["OCRed"]) == "False") 
      {      
       item["OCRed"] = "True"; 
       Thread.Sleep(10000); 
       item.SystemUpdate(); 
       Log("Item Added and Updated."); 
      } 
      else 
      { 
       Log("Can not update the Item."); 
      } 
     } 
     Log("Event End."+"\r\n"); 
    } 
    catch (Exception ex) 
    { 
     Log("Error in Item Added Event Receiver."); 
     Log(ex.ToString());    
    } 
} 

public void callService() 
{ 
    Log("Calling Service is not easy."); 
    try 
    { 
     ProcessStartInfo pinfoService = new ProcessStartInfo(); 
     pinfoService.FileName = @"D:\Khan\khan.exe"; 
     //pinfoService.FileName = @"C:\Windows\System32\notepad.exe"; 
     pinfoService.UseShellExecute = false; 
     pinfoService.RedirectStandardError = true; 
     pinfoService.RedirectStandardInput = true; 
     pinfoService.RedirectStandardOutput = true; 
     pinfoService.CreateNoWindow = true; 
     pinfoService.WindowStyle = ProcessWindowStyle.Hidden; 
     Log("FileName: " + pinfoService.FileName); 
     Log("Arguments for callService : "+pinfoService.Arguments); 
     Process pService = new Process(); 

     pService.StartInfo = pinfoService; 
     Log("Process Before Start."); 
     Thread.Sleep(5000); 
     pService.Start(); 
     Thread.Sleep(2000); 
     Log("Process Before wait for exit."); 
     pService.WaitForExit(); 
     Log("Process Completed."); 
    } 
    catch (Exception ex) 
    { 
     Log("Error in callService(). Please contact your Administrator."); 
     Log(ex.ToString()); 
    } 
} 

와 나는 문제를 알아낼 수 없습니까 pService.Start();

========================================= 

Info : Process Before Start. 

Info : Error in callService(). Please contact your Administrator. 

Info : System.ComponentModel.Win32Exception: Not enough quota is available to process this command 

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) 

    at OCRonUploadDoc.EventReceiver1.EventReceiver1.callService() 

========================================= 

에 점점 오전 오류입니다. 도와주세요 ... !!!

미리 감사드립니다.

  • 칸 Abubakar는

답변

0

나는 응용 프로그램 풀을 실행 권한을 가지고 있지 않는 아래 asp.net 계정을 exe 파일을 시작할 수 있다고 생각합니다. 이것을 확인할 수 있습니다 http://www.daniweb.com/web-development/aspnet/threads/386380/cannot-run-exe-files-in-asp.net-application 그러나 더 많은 사용자가 시스템을 사용하면 문서를 변경할 때마다 새로운 프로세스가 생성되기 때문에 문제가 발생할 수 있습니다. 서버의 RAM이 부족하여 팜을 사용할 수 없습니다.

관련 문제