【发布时间】:2017-01-22 09:18:59
【问题描述】:
我有一个 ASPX 网站,它可以抓取屏幕截图并将其返回给我。该站点在开发服务器上运行,但是当移动到 Prod 时,无论如何我都会在同一行出现错误(即使是空白的)。这是我的错误:
这是我用来发出 API 请求的代码。我将 html 中的图像 url 设置为下载的文件位置。在我迁移到 Prod 之前,它一直对我有用。开发服务器和生产服务器具有相同的配置,并且所有代码都已更改以反映迁移。
protected void Screen_Shot()
{
string input = TextBox1.Text;
using (var client = new WebClient())
{
string filename = @"C:\Screen_Shot.jpg";
string destination = @"http://api.screenshotmachine.com/?key=111111&size=N&url=" + input;
try{
client.DownloadFile(destination, filename);
Image1.Visible = true;
}
catch(Exception)
{
Image1.Visible = true;
Image1.ImageUrl = @"C:\Windows\Temp\screenshot_error.jpg";
}
}
}
【问题讨论】:
-
尝试通过 Fiddler 捕获请求。这可能有助于缩小范围。
-
看起来 IIS 池使用的是旧版本的 dll。你确定在部署后回收它吗?
-
@Andrei 是的,我已经刷新了网站的实例。我还在网站的其他部分使用该 dll,运行良好。
标签: c# asp.net iis error-handling