0

我有两个应用程序,使用一个通用方法和相同的代码,第一个应用程序是一个 32 位编译的网站,第二个是 64 位编译的 wcf 服务。

两台机器都是 64 位:Ram 6 gb 处理器 Intel(R) Xeon(R) CPU E5645 @2.40 GHZ

问题是同一段代码在 WCF 服务中运行时需要更多时间:

    Private Shared Sub AddImageToOutputPDF(ByRef pdfDoc As PdfSharp.Pdf.PdfDocument, ByVal freeImg As FreeImgDLL.freeImage)
    Dim page As PdfSharp.Pdf.PdfPage = pdfDoc.AddPage
    Dim gfx As PdfSharp.Drawing.XGraphics = PdfSharp.Drawing.XGraphics.FromPdfPage(page)
    Dim ts As New TimeSpan
    Dim st As New DateTime
    Dim en As New DateTime

    st = DateTime.Now
    If freeImg.verticleDPI = 0 Then
        freeImg.EstimateAndSetResolution()
    End If


    Dim tiffImage As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromFreeImage(freeImg)

    page.Width = New PdfSharp.Drawing.XUnit((tiffImage.Width / tiffImage.HorizontalResolution) * 72)
    page.Height = New PdfSharp.Drawing.XUnit((tiffImage.Height / tiffImage.VerticalResolution) * 72)


    gfx.DrawImage(tiffImage, 0, 0, page.Width, page.Height)

    en = DateTime.Now

    ts = en - st

    _log.Debug("Page Operation--- Add Page To Pdf using PdfSharp. ------------------Time in seconds: " + ts.TotalSeconds.ToString)

End Sub

有什么想法吗?

4

0 回答 0