私はSharePoint Foundationを使用しています。私はいくつかの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()
=========================================
に取得していますエラーです。私を助けてください...!!!
ありがとうございました。
- カーンアブバカル