Unable to Use MicrosoftReport Viwer in containerized environment

balaji k 0 Reputation points
2025-05-19T07:44:08.05+00:00

HI team ,

I am have a Asp.net application with 4.7.2 version and my reporting relay on RDLC and XSLT templates , with microsoft reportviewerversion 15 , I am trying to Run in a containerized Environment with ECS on AWS Fargate with windows support

ISSUE IN DETAIL

when I try to Export a PDF print from environment, I am getting this below error.

Unable to load DLL 'T2Embed': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I can understand that report viewer is expecting the DLL for emending fonts which is available inside System32 folder of C drive which is not available in Container,

I have tried disabling the DLL dependency by below codes

 Dim deviceInfo As String = "

                           "  " &

                           ""

Dim reportData() As Byte = report.Render(reportFormat, deviceInfo, mimeType, encoding, fileNameExtension, streams, warnings) But issue is still unresolved please provide support on this , And thanks in advance.

Regards

Balaji K

Developer technologies | ASP.NET | ASP.NET API
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 79,101 Reputation points Volunteer Moderator
    2025-05-19T17:16:42.24+00:00
    0 comments No comments

  2. Raymond Huynh (WICLOUD CORPORATION) 620 Reputation points Microsoft External Staff
    2025-07-03T08:24:38.32+00:00

    Hi Balaji,

    This is a common issue when running Report Viewer in Windows containers. The T2Embed.dll is part of the Windows font subsystem and is typically missing or inaccessible in containerized environments.

    Here are a few solutions you can try:

    Option 1: Use a different base image

    Try using a Windows Server Core base image instead of Nano Server, as it includes more system components:

    FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2-windowsservercore-ltsc2019
    

    Option 2: Install the missing font components

    Add this to your Dockerfile to install the necessary Windows features:

    RUN Add-WindowsFeature Server-Media-Foundation RUN DISM /Online /Enable-Feature /FeatureName:ServerMediaFoundation /All
    

    Option 3: Use alternative PDF rendering

    Since you're already trying to disable font embedding, you might want to switch to a different PDF rendering approach. Consider using libraries like:

    • SelectPdf
    • iTextSharp
    • PdfSharp

    Option 4: Font embedding workaround

    Try this more complete device info configuration:

    Dim deviceInfo As String = "<DeviceInfo>" & _     "<OutputFormat>PDF</OutputFormat>" & _     "<EmbedFonts>None</EmbedFonts>" & _     "<PrintDpiX>300</PrintDpiX>" & _     "<PrintDpiY>300</PrintDpiY>" & _     "</DeviceInfo>"
    

    Option 5: Copy required DLLsAs a last resort, you can try copying the T2Embed.dll from a full Windows installation to your container, though this isn't recommended and may have licensing implications.

    The Windows Server Core approach (Option 1) is usually the most reliable solution for Report Viewer in containers, even though it results in a larger image size.

    Let me know if any of these approaches work for you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.