動的コンテンツのスクレイピングのためにサイトを PhantomJS と統合しようとしています。Process.Start を介してこれを行い、スクレイピング スクリプトと一緒に PhantomJS を起動します。これは私の開発マシンでうまく機能します。
私のホストで、私が持っている信頼レベルを調べたところ、そのレベルはUnrestrictedで、完全な信頼よりも高くなっていますよね?
それでも、Process.Start でアクセス許可が拒否されます。
信頼レベルが制限されていないのに、これはなぜですか?
[編集] System.ComponentModel.Win32Exception (0x80004005): System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) で System.Diagnostics.Process.Start() で StrengthTracker.Controllers.AppController.Index() でアクセスが拒否されました
プロセスを実行するためのコードは次のとおりです。
string path = Server.MapPath(".");
path = Directory.GetParent(path).FullName;
path = path + "\\data";
Response.Write("path:" + path);
string a = "\"" + path + "\\scrape.js" + "\" \"" + url + "\"";
var processStartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardInput = true,
UseShellExecute = false,
Arguments = a,
FileName = path + "\\phantomjs.exe"
};
var process = new Process
{
StartInfo = processStartInfo,
EnableRaisingEvents = true
};
//pipe the output
process.OutputDataReceived += (sender, args) => outputBuilder.Append(args.Data);
try
{
process.Start();
process.BeginOutputReadLine();
process.WaitForExit(20000);
process.CancelOutputRead();
}
catch (Exception x)
{
return Content(x.ToString());
}
return Content(outputBuilder.ToString());
[再編集] このサイトは私のホストのネットワーク共有上にあるようです。パスは「\foo\bar\bla」のようになります
それが問題ですか?共有で何かを開始する際の制限?