我正在尝试使用phantomjs抓取我自己网站的快照 - 基本上,这是创建用户提交内容的"预览图像".
我在服务器上安装了phantomjs并确认从命令行运行它对适当的页面工作正常.但是,当我尝试从网站上运行它时,它似乎没有做任何事情.我已经确认正在调用代码,幻像实际上正在运行(我监视过程,并且当我调用它时可以看到它出现在进程列表中) - 但是,没有生成图像.
我不知道我应该在哪里找出它为什么不会创建图像 - 任何建议?相关代码块如下:
string arguments = "/c rasterize.js http://www.mysite.com/viewcontent.aspx?id=123";
string imagefilename = @"C:\inetpub\vhosts\mysite.com\httpdocs\Uploads\img123.png";
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.FileName = @"C:\phantomjs.exe";
p.StartInfo.Arguments = arguments + " " + imagefilename;
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Run Code Online (Sandbox Code Playgroud)