Использование Stimulsoft в контейнере Docker (net core)
Добавлено: 15 янв 2019, 12:55
Добрый день!
При использовании отчетов из Linux контейнера Docker в дизайнере отчета появляется ошибка:
An unhandled exception occurred while processing the request.
DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
Interop+Libdl.dlopen(string fileName, int flag)
TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.Drawing.SafeNativeMethods+Gdip.GdipNewPrivateFontCollection(out IntPtr fontCollection)
TypeInitializationException: The type initializer for 'Stimulsoft.Base.StiFontCollection' threw an exception.
Stimulsoft.Base.StiFontCollection.GetFontFamilies() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs, line 83
DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
Interop+Libdl.dlopen(string fileName, int flag)
System.Drawing.SafeNativeMethods+Gdip.LoadNativeLibrary()
System.Drawing.SafeNativeMethods+Gdip..cctor()
Show raw exception details
TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.Drawing.SafeNativeMethods+Gdip.GdipNewPrivateFontCollection(out IntPtr fontCollection)
System.Drawing.Text.PrivateFontCollection..ctor()
Stimulsoft.Base.StiFontCollection..cctor() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs
Show raw exception details
TypeInitializationException: The type initializer for 'Stimulsoft.Base.StiFontCollection' threw an exception.
Stimulsoft.Base.StiFontCollection.GetFontFamilies() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs
Stimulsoft.Report.Web.StiFontNames.GetItems() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.WebDesign\Helpers\StiFontNames.cs
Stimulsoft.Report.Mvc.StiNetCoreDesigner.RenderJsonParameters() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\Designer\StiNetCoreDesigner.Render.cs
Stimulsoft.Report.Mvc.StiNetCoreDesigner.CreateChildControls() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\Designer\StiNetCoreDesigner.Render.cs
Stimulsoft.Report.Mvc.StiNetCoreHelper.StiNetCoreDesigner(IHtmlHelper htmlHelper, string ID, StiNetCoreDesignerOptions options) in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\StiNetCoreHelper.cs
AspNetCore.Views_Design_Reports.ExecuteAsync() in C:\QSPro1\src\QuestionnaireStudioPro\Views\Design\Reports.cshtml
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Dockerfile:
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["src/QuestionnaireStudioPro/QuestionnaireStudioPro.csproj", "src/QuestionnaireStudioPro/"]
RUN dotnet restore "src/QuestionnaireStudioPro/QuestionnaireStudioPro.csproj"
COPY . .
WORKDIR "/src/src/QuestionnaireStudioPro"
RUN dotnet build "QuestionnaireStudioPro.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "QuestionnaireStudioPro.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
# install System.Drawing native dependencies
RUN apt-get update \
&& apt-get install -f -y --allow-unauthenticated \
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu52 \
liblttng-ust0 \
libssl1.0.0 \
libstdc++6 \
libunwind8 \
libuuid1 \
libgdiplus \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["dotnet", "QuestionnaireStudioPro.dll"]
Что делать ?
При использовании отчетов из Linux контейнера Docker в дизайнере отчета появляется ошибка:
An unhandled exception occurred while processing the request.
DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
Interop+Libdl.dlopen(string fileName, int flag)
TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.Drawing.SafeNativeMethods+Gdip.GdipNewPrivateFontCollection(out IntPtr fontCollection)
TypeInitializationException: The type initializer for 'Stimulsoft.Base.StiFontCollection' threw an exception.
Stimulsoft.Base.StiFontCollection.GetFontFamilies() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs, line 83
DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
Interop+Libdl.dlopen(string fileName, int flag)
System.Drawing.SafeNativeMethods+Gdip.LoadNativeLibrary()
System.Drawing.SafeNativeMethods+Gdip..cctor()
Show raw exception details
TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.Drawing.SafeNativeMethods+Gdip.GdipNewPrivateFontCollection(out IntPtr fontCollection)
System.Drawing.Text.PrivateFontCollection..ctor()
Stimulsoft.Base.StiFontCollection..cctor() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs
Show raw exception details
TypeInitializationException: The type initializer for 'Stimulsoft.Base.StiFontCollection' threw an exception.
Stimulsoft.Base.StiFontCollection.GetFontFamilies() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Base\StiFontCollection.cs
Stimulsoft.Report.Web.StiFontNames.GetItems() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.WebDesign\Helpers\StiFontNames.cs
Stimulsoft.Report.Mvc.StiNetCoreDesigner.RenderJsonParameters() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\Designer\StiNetCoreDesigner.Render.cs
Stimulsoft.Report.Mvc.StiNetCoreDesigner.CreateChildControls() in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\Designer\StiNetCoreDesigner.Render.cs
Stimulsoft.Report.Mvc.StiNetCoreHelper.StiNetCoreDesigner(IHtmlHelper htmlHelper, string ID, StiNetCoreDesignerOptions options) in D:\Stimulsoft\Stimulsoft.Reports\.NetCore\Stimulsoft.Report.Mvc.NetCore\StiNetCoreHelper.cs
AspNetCore.Views_Design_Reports.ExecuteAsync() in C:\QSPro1\src\QuestionnaireStudioPro\Views\Design\Reports.cshtml
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Dockerfile:
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["src/QuestionnaireStudioPro/QuestionnaireStudioPro.csproj", "src/QuestionnaireStudioPro/"]
RUN dotnet restore "src/QuestionnaireStudioPro/QuestionnaireStudioPro.csproj"
COPY . .
WORKDIR "/src/src/QuestionnaireStudioPro"
RUN dotnet build "QuestionnaireStudioPro.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "QuestionnaireStudioPro.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
# install System.Drawing native dependencies
RUN apt-get update \
&& apt-get install -f -y --allow-unauthenticated \
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu52 \
liblttng-ust0 \
libssl1.0.0 \
libstdc++6 \
libunwind8 \
libuuid1 \
libgdiplus \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["dotnet", "QuestionnaireStudioPro.dll"]
Что делать ?