Running Crystal Report 2008 in Docker

Running Crystal Report 2008 in Docker is not a straightforward approach. If we want to run crystal report in production environment, then we have to follow the below steps –

  1. Install CR 2008 Redistributable project.
  2. Set the flag enable32BitAppOnWin64 as true to the app pool of the application.

If our crystal report is built on 32-bit environment, then we need Redistributable package for 32 bit and step (b) is required.

To install CR runtime in a virtual machine we can follow the above mentioned steps and it’s done with that, but to install the same in Docker we have to add one more step.

Let us consider our HMS application (Read the post 1 & 2 related to Docker).

Post 1: https://smoothknowledge.com/2018/01/18/deploying-a-legacy-asp-net-app-to-docker/

Post 2: https://smoothknowledge.com/2018/01/30/deploy-legacy-asp-net-application-docker-swarm-mode/

We are displaying some reports like Patient Information, Lab reports etc. with the help of crystal report. So, let us create a BASE Image that will be used to create specific module images. A base image can be created with the below command,

The Dockerfile would look like,

FROM microsoft/aspnet:3.5

# Copy the infrastructures
COPY ./Infra /Infra

#install crystal report 2008 runtime x86 version
WORKDIR /infra
RUN [“powershell”, “msiexec”, “/i”, “CRRedist2008_x86.msi”, “/qn”, “/lime”, “./Error1.log”]

Let us give the name of the base image as hmsbase. Now other modules would be created from hmsbase instead of ASP.NET 3.5 image like,

FROM hmsbase

# Copy the required directories
COPY ./PublishedFolder /inetpub/wwwroot
COPY ./infra /infra

# Set the Working directory as wwwroot and run the ps scripts to create/set required app pools
WORKDIR /inetpub/wwwroot
RUN [“powershell”,”../../infra/createapppools.ps1″]
RUN [“powershell”,”../../infra/setpools.ps1″]
WORKDIR /windows/system32/inetsrv
CMD appcmd.exe set apppool /apppool.name:HMSAppPool /enable32BitAppOnWin64:true

Now, with this setup, if we run Crystal report, then it will fail with an error related to sacommlayer DLL.

After digging several days, we found the root cause. Actually, the problem is there in ASP.NET 3.5 Docker image. As container doesn’t required any graphics, so Microsoft removed all the graphics related dependencies and as part of this they have removed the oledlg.dll from system32 and syswow64 under windows folder of ASP.NET 3.5 image. The sacommlayer dll is dependent on oledlg.dll file. As this dll is not present by default, system was failing to load the crystal report.

Therefore, our resolution approach is straight forward, just copy the oledlg.dll to the container. We can re-write the steps to create HMS Base image,

FROM microsoft/aspnet:3.5

 # Copy the infrastructures
COPY ./Infra /Infra
# Copy the oledlg.dll to syswow64 and register it
WORKDIR /windows/syswow64/
COPY /infra/syswow64/oledlg.dll /windows/syswow64/
CMD regsvr32.exe oledlg.dll /s

 #install crystal report 2008 runtime x86 version
WORKDIR /infra
RUN [“powershell”, “msiexec”, “/i”, “CRRedist2008_x86.msi”, “/qn”, “/lime”, “./Error1.log”]

As our application is 32 bit, so we copy the oledlg.dll to syswow64 folder of the container. This DLL is available on any windows system. You just need to copy it to infra folder before creating the image.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.