2014-09-26 21 views
1

我得到了一個在Windows Azure Web角色上運行的ASP.NET MVC(Razor View Engine和C#)應用程序。使用自定義字體的RDLC報告 - 錯誤HRESULT E_FAIL已從調用COM組件返回

我使用RDLC本地報告創建帶有各自條形碼的可打印價格標籤的PDF文件。

我在使用啓動任務安裝條形碼字體(TrueType)之後使用了Azure。最近,沒有我改變任何與此功能相關的東西,它就停止了工作。

我收到以下錯誤,至此我沒有找到任何解決方案。我知道問題是條形碼字體,因爲pdf是用像Arial這樣的標準字體生成的。此外,它可以在我的電腦上本地運行應用程序時與條形碼完美協同工作。

Error HRESULT E_FAIL has been returned from a call to a COM component. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:  

[COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.] 
    System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0 
    Microsoft.ReportingServices.Rendering.RichText.TextRun.ShapeAndPlace(Win32DCSafeHandle hdc, FontCache fontCache) +1450 
    Microsoft.ReportingServices.Rendering.RichText.TextRun.GetWidth(Win32DCSafeHandle hdc, FontCache fontCache, Boolean isAtLineEnd) +30 
    Microsoft.ReportingServices.Rendering.RichText.LineBreaker.GetLine(Paragraph paragraph, TextLine line, Win32DCSafeHandle hdc, FontCache fontCache, FlowContext flowContext, Single left, Single right, Single height, Stack`1 lineRunsIndex, Stack`1 lineRunsCharIndex, Int32 lineIndents) +266 
    Microsoft.ReportingServices.Rendering.RichText.LineBreaker.FlowParagraph(Paragraph paragraph, Directions direction, Win32DCSafeHandle hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, SizeF flowContextSize, Int32& contentOffset) +768 
    Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox textBox, Win32DCSafeHandle hdc, Single dpiX, FontCache fontCache, FlowContext flowContext, Boolean keepLines, Single& height) +617 
    Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox textBox, Graphics g, FontCache fontCache, FlowContext flowContext, Boolean keepLines, Single& height) +182 
    Microsoft.ReportingServices.Rendering.RichText.TextBox.MeasureFullHeight(TextBox textBox, Graphics g, FontCache fontCache, FlowContext flowContext, Single& contentHeight) +759 
    Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.CalculateVerticalSize(PageContext pageContext) +467 
    Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors) +35 
    Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable`1 sourceWidth) +977 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddRowMember(TablixMember rowMember, Int32 colIndex, Int32 rowSpan, Int32 colSpan, LevelInfo childInfo, PageContext pageContext, Double updateWidth) +1104 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateRowMemberChildren(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Boolean parentBorderHeader, Int32 parentRowIndex, Int32 parentColIndex, Int32 sourceIndex, Boolean resetContext, Boolean parentHasFooters, LevelInfo parentLevelInfo, PageContext pageContext) +4255 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateRowMemberChildren(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Boolean parentBorderHeader, Int32 parentRowIndex, Int32 parentColIndex, Int32 sourceIndex, Boolean resetContext, Boolean parentHasFooters, LevelInfo parentLevelInfo, PageContext pageContext) +3657 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateTablixRows(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Boolean parentBorderHeader, Int32 parentRowIndex, Int32 parentColIndex, List`1& pageStructMemberCell, Boolean ignoreTotals, Boolean& finishLevel, Boolean parentHasFooters, CreateItemsContext createItems, Double startInTablix, Double endInTablix, PageContext pageContext) +4341 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateTablixItems(Tablix tablix, PageContext pageContext, CreateItemsContext createItems, Double startInTablix, Double endInTablix) +239 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateVertically(PageContext pageContext, CreateItemsContext createItems, Double startInTablix, Double endInTablix, Double topInParentSystem) +374 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors) +662 
    Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable`1 sourceWidth) +977 
    Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.DetermineContentVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Boolean resolveState, Boolean resolveItem) +496 
    Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors) +281 
    Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable`1 sourceWidth) +977 
    Microsoft.ReportingServices.Rendering.HPBProcessing.ReportSection.NextPage(RPLWriter rplWriter, Int32 pageNumber, Int32 totalPages, Double top, Double availableHeight, ReportSection nextSection, Boolean isFirstSectionOnPage) +1382 
    Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 totalPages) +384 
    Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport) +437 
    Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream) +1021 
    Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream) +93 

我的源代碼:

LocalReport report = new LocalReport(); 
// Rdlc file path 
report.ReportPath = Server.MapPath("~/Reports/PriceTags.rdlc"); 

// Data source 
report.DataSources.Add(new ReportDataSource("productsDataSet", dataset1)); 

// Some parameters 
ReportParameterCollection reportParameters = new ReportParameterCollection(); 
reportParameters.Add(new ReportParameter("currency", "EUR")); 
reportParameters.Add(new ReportParameter("precision", 2)); 
report.SetParameters(reportParameters); 

// FileContentResult GenPdf(LocalReport report, string filename) 
return GenPdf(report, "Price Tags"); 

在這個問題上的任何幫助將受到歡迎和遺憾,對任何語法錯誤。

在此先感謝。

回答

1

我能夠通過遠程桌面訪問我的Web角色的虛擬機並執行簡單的REBOOT來解決我的問題。

此致敬禮。

相關問題