2009-10-05 17 views
3

有沒有人可以從ABCpdf中刪除這個異常?我們在Server 2008上運行,只有轉換Office文件(Word和Excel)的問題。這一切都在Server 2003上運行良好。因爲我們只有Office文件的問題,我想知道它是否與Server 2008上的XPS支持有關?調用此函數的代碼作爲Windows服務運行。使用Windows Server 2008上的ABCpdf.NET將Office文件轉換爲PDF的異常

Private Overloads Function ConvertMicrosoftOfficeDocToPdf(ByVal inputFile As Byte(), ByVal fileExt As String) As Byte() 
    Dim abcDoc As WebSupergoo.ABCpdf7.Doc = Nothing 

    Try 
     abcDoc = New WebSupergoo.ABCpdf7.Doc() 

     Dim xro As New WebSupergoo.ABCpdf7.XReadOptions() 
     xro.FileExtension = fileExt 

     Try 
      abcDoc.Read(inputFile, xro) 
     Catch ex As Exception 
      System.Diagnostics.Trace.Write(ex.ToString()) 
      Throw ex 
     End Try 

     Dim fileBytes As Byte() = abcDoc.GetData() 
     Return fileBytes 
    Finally 
     If Not abcDoc Is Nothing Then 
      abcDoc.Clear() 
      abcDoc.Dispose() 
     End If 
    End Try 
End Function 

WebSupergoo.ABCpdf7.Internal.PDFException: 試圖讀取或寫入受保護的內存 。這通常表明 其他內存已損壞。 ---> System.AccessViolationException: 試圖讀取或寫入受保護的 內存。這通常表明 其他內存已損壞。 在WebSupergoo.ABCpdf7.Internal.NDoc._InvokeMethod(IntPtr的 inDoc,的Int32 inMethod,的Int32 inIndex, 的Int32 inFlags,字符串inParams, 字符串& outErr) 在WebSupergoo.ABCpdf7.Internal.NDoc.InvokeMethod(IntPtr的 inDoc, INT32 inMethod,INT32 inIndex, INT32 inFlags,字符串inParams, 字符串& outErr) 在WebSupergoo.ABCpdf7.Doc.PrintToXps(字符串 INPUTFILE,字符串OUTPUTFILE,INT32 超時,字符串PRINTERNAME) 在WebSupergoo.ABCpdf7.Operations。 XpsImportOperation.ImportAny(Doc doc,字符串路徑,Int32超時) 在WebSupergoo.ABCpdf7.XReadOptions.ImportXpsAny(文件 DOC,字符串路徑,布爾清除) 在WebSupergoo.ABCpdf7.XReadOptions.Read(文件 DOC,字節[]數據,ReadModuleType 模塊) 在WebSupergoo.ABCpdf7.XReadOptions .Read(文件 DOC,字節[]數據)

回答

0

實際的問題是,您正在嘗試寫入文件的文件夾,將寫入權限授予IIS_IUSR。那麼它應該工作。

相關問題