I'm trying to integrate my site with PhantomJS for scraping of dynamic content. I do this via Process.Start and start up PhantomJS together with my scraping script. This works great on my devmachine.
On my host, I have examined what trustlevel I have and the level is Unrestricted , that is higher than Full trust, right?
Still, I get a permission denied on the Process.Start.
Why is this when the trust level is unrestricted?
[Edit] System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at StrengthTracker.Controllers.AppController.Index()
the code for executing the process is:
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());
[edit again] The site seems to reside on a network share on my host. the path looks like this "\foo\bar\bla"
Is that the problem? restrictions starting something on a share?
You can try
http://support.microsoft.com/default.aspx?scid=kb;en-us;317012
or else, it might be a folder security issue. The folder in which the files are kept, must have Modify access to Users. IIS_WPG under which IIS Process run, that user belongs to Users group, this user must have Modify access on the folder.