IIS error:The remote server returned an error: NotFound
近日弄了段以下程序(程序发布在IIS上,程序在运行时要到网站下载文件 ):
WebClient client = new WebClient();
client.DownloadStringCompleted += delegate(object s, DownloadStringCompletedEventArgs de)
{
if (de.Error != null)
{
LoadingMessage = "An error occured: " + de.Error.Message;
return;
}
}
client.DownloadProgressChanged += delegate(object sender, DownloadProgressChangedEventArgs e)
{
Deployment.Current.Dispatcher.BeginInvoke(delegate()
{
LoadProgress = e.BytesReceived / (double)e.TotalBytesToReceive;
});
};
client.DownloadStringCompleted += delegate(object s, DownloadStringCompletedEventArgs de)
{
if (de.Error != null)
{
LoadingMessage = "An error occured: " + de.Error.Message;
return;
}
}
client.DownloadProgressChanged += delegate(object sender, DownloadProgressChangedEventArgs e)
{
Deployment.Current.Dispatcher.BeginInvoke(delegate()
{
LoadProgress = e.BytesReceived / (double)e.TotalBytesToReceive;
});
};
client.DownloadStringAsync(ModelUri);
发现,在调试的时候怎么都好使,一旦发布到IIS就有问题。后来用上面代码段跟踪,发现,报Error:“The remote server returned an error: NotFound”;
如果你出现了这个问题,十有八九就是IIS站点配置的MIME Types缺少了要下载文件的后缀。我的就是缺了个.dae。加上即问题解决。