0
ASP.Net Webservice(.asmx)からプロセスを実行します。 Webserviceのホストされたディレクトリには、webserviceディレクトリの "importerapp"フォルダに実行可能なアプリケーションがあります。私の実行可能なアプリは、(Import.exeという名前の)ダブルクリックでうまくいきます。実行可能なアプリケーション(.exe)がASP.Net Webサービス(.asmx)経由で実行されていません
My webservice is running with no error but the process is not executed.
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public string executeProcess(RunMode mode)
{
Process process = new Process();
process.StartInfo.FileName = Server.MapPath("importerapp/Import.exe");
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.Arguments = "mode=" + (int)_runMode ;
process.Start();
process.WaitForExit();
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
return("Job Submitted OK with params: "+_runMode + error
+ output +"Exit Code:"+ process.ExitCode);
}
出力は以下の通りです。
<string xmlns="http://tempuri.org/">Job Submitted OK with
params: Exit Code:0</string>
つまり、「エラー」と「出力」変数はnullで、終了コードは0で成功を意味します。
しかし、処理は何もしません。ログファイルを作成しなくても(nLogライブラリを使用しています)。
環境:Windows7の、.Net4.0、C#、ASP.Net
はお知らせください、IIS 7.5を。おかげさまで Ruhul
ありがとうVMAtm。 _runModeは、1つのデフォルト値で初期化されます。だからそれは問題ではありません。 他のアイデアはありますか?おかげさまで –
あなたのコードを見てください - 結果にはデフォルト値はありません。それを確認します。 – VMAtm
申し訳ありませんが、これはデフォルト値のクラスメンバーとして宣言されています。あなたのコメントは有効ですが、問題ではありません。どうもありがとう。 –