在过去的两天里,我一直在研究一个问题,我尝试了所有可能的调试方法,但都是徒劳的。在生产环境中,我的local.But上一切正常,但失败了。以下是对该问题的简要描述。我有一个下载按钮,当我点击这个按钮时,我打算从服务器上下载一个文件。
受保护的无效发送者(object Download_Click,EventArgs e) {
Button downloadButton = sender as Button;
string filePath = downloadButton.CommandArgument;
string stuid = Session["browse_files_for_student"].ToString();
string stuUsername = MyHelper.GetUsernameForStudentID(stuid);
MyHelper.LogAccess(User.Identity.Name, StudentUsername.Text, filePath, MyHelper.LogAccessType.Read);
FileInfo file = new FileInfo(filePath);
// Download the file
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" + file.Name);
try
{
Response.TransmitFile(filePath);
}
catch (IOException error)
{
Response.Cookies.Add(new HttpCookie("global_last_error", "The file is in use by another process."));
Response.Redirect("~/Public/KnownError.aspx");
}
Response.End();
}我在事件查看器上看到它生成: TransmitFile failed:FileName:dsdfsfd.doc,模拟启用:0,Token Valid:1 HRESULT:0x8007052e。
环境:网站部署在Windows 2000服务器上。
如有任何帮助和意见,我们将不胜感激。谢谢。
发布于 2012-09-27 23:14:34
运行应用程序所使用的帐户(可能是IIS池帐户)无权访问您尝试发送的文件。错误代码0x8007052e表示:
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.以后您可以使用例如cdb命令来检查错误代码(cdb是免费提供的Windows调试工具的一部分):
cdb notepad.exe然后在启动后:
0:000> !error 0x8007052e
Error code: (HRESULT) 0x8007052e (2147943726) - Logon failure: unknown user name or bad password.希望它能有所帮助:)
https://stackoverflow.com/questions/12612701
复制相似问题