【发布时间】:2013-04-14 10:01:21
【问题描述】:
我尝试通过RadPdf 控件打开我的 PDF,但出现渲染错误。我检查事件查看器并获得以下数据:
为了解决这个问题,我必须创建C:\WINDOWS\TEMP\RadPdfTemp\ 并且管理员每隔一段时间清空临时文件并删除该文件夹,我尝试在我的网站中创建具有所需权限的该文件夹,但仍然出现相同的错误!
this.rad_pdf.CreateDocument("Document Name", pdfData);
我通过以下方式获得pdfData:
private byte[] AddReportToResponse(LocalReport followsReport)
{
string mimeType;
string encoding;
string extension;
string[] streams = new string[100];
Warning[] warnings = new Warning[100];
byte[] pdfStream = followsReport.Render("PDF", "", out mimeType, out encoding, out extension, out streams, out warnings);
return pdfStream;
}
Event Type: Error
Event Source: RAD PDF
Event Category: None
Event ID: 0
Date: 4/21/2013
Time: 2:33:50 PM
User: N/A
Computer: -----
Description:
Event Category
-----------------
PdfService
Event Description
-----------------
RAD PDF Service Message Worker Thread Unknown Exception
Exception Type:
System.IO.DirectoryNotFoundException
Exception Message:
Could not find a part of the path 'C:\WINDOWS\TEMP\RadPdfTemp\p476.tmp'.
Exception Stack Trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
at #Ew.#Rw.#ix()
at #Ew.#Rw.#9w()
Event User
-----------------
NT AUTHORITY\SYSTEM
Event Version
-----------------
2.12.0.0
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
【问题讨论】:
-
澄清“管理员每隔一段时间清空临时文件并删除此文件夹”可能有助于其他人帮助您。你这是什么意思?您的意思是您手动创建
C:\WINDOWS\TEMP\RadPdfTemp,这可以暂时解决问题,但管理员(作业)会每隔一段时间清空C:\WINDOWS\TEMP,删除RadPdfTemp子文件夹? -
还值得澄清以帮助其他人帮助您:“我尝试在我的网站中创建具有所需权限的此文件夹,但仍然出现相同的错误!!!”所以当你尝试在你的网页代码中创建
C:\WINDOWS\TEMP\RadPdfTemp时,它是创建成功了吗?所需的权限是什么 - 我假设您在手动创建文件夹时设置的权限?您是否尝试过在 Web 代码中写出您正在创建的文件夹的路径,然后将其粘贴到 Windows 运行...对话框或 Windows 资源管理器中以确认它已打开(您所期望的)? -
@J0e3gan ::
Do you mean that you create C:\WINDOWS\TEMP\RadPdfTemp manually, which fixes the issue for a while, but an admin (job) empties C:\WINDOWS\TEMP at intervals, removing the RadPdfTemp subfolder?是的,这正是我所做的。
标签: c# asp.net file iis permissions