Pending Review
Last Updated: 23 Apr 2019 07:45 by Anders
Anders
Created on: 22 Apr 2019 06:44
Type: Bug Report
0
Can not run in docker

In CSharp.ReportExamples.VS2017, I copy all reports into project CSharpAspNetCoreDemo, and make them always copy.

Then I change ReportsController to the Reports directory above.

When Run it in IIS, it's OK, but when check into Docker, there is an exception thrown.

{
	"message": "An error has occurred.",
	"exceptionMessage": "Type: Telerik.Reporting.XmlSerialization.Current.ReportSerializable`1[Telerik.Reporting.Report]",
	"exceptionType": "System.MissingMethodException",
	"stackTrace": "   at Telerik.Reporting.Xml.ObjectXmlReader.CreateInstance(Type type, String name)\n   at Telerik.Reporting.Xml.ObjectXmlReader.ReadObject(Type type)\n   at Telerik.Reporting.Xml.ObjectXmlReader.ReadXmlElement(String name)\n   at Telerik.Reporting.Xml.XmlSerializer.Deserialize(Stream stream, IResourceHandler resourceHandler)\n   at Telerik.Reporting.XmlSerialization.ReportXmlSerializer.Telerik.Reporting.XmlSerialization.IXmlSerializer.Deserialize(Stream stream, IResourceHandler resourceHandler)\n   at Telerik.Reporting.ReportPackager.UnpackageDocument(Stream packageStream)\n   at Telerik.Reporting.Processing.UriReportDocumentResolver.Resolve(IProcessingContext context, UriReportSource rs)\n   at Telerik.Reporting.Processing.ReportDocumentResolver.Bind[T](IProcessingContext context, ReportSource source, Func`2 func)\n   at Telerik.Reporting.Processing.ResolvedReportDocument.ResolveReportsRecursively(ReportSource rs, IProcessingContext context, IDictionary`2 parentRsParameters, Boolean parentShouldDispose, List`1 result, IReportDocument& definition, ResolvedReport& tocReport, ReportBookTocPosition& tocReportPosition)\n   at Telerik.Reporting.Processing.ResolvedReportDocument.Create(ReportSource rs, IProcessingContext context)\n   at Telerik.Reporting.Services.Engine.ReportEngine.GetParameters(String clientID, String report, Dictionary`2 parameterValues)\n   at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource)\n   at lambda_method(Closure , Object , Object[] )\n   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\n   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()"
}

This is my Dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /
COPY ["AspNetCoreDemo/CSharpAspNetCoreDemo", "AspNetCoreDemo/"]
RUN  restore "AspNetCoreDemo/CSharpAspNetCoreDemo"
COPY .
WORKDIR "/src/AspNetCoreDemo"
RUN  build "CSharpAspNetCoreDemo" -c Release -o /app

FROM  AS publish
RUN  publish "CSharpAspNetCoreDemo" -c Release -o /app

FROM base AS final
RUN apt-get update \ 
    && apt-get install -y --allow-unauthenticated \ 
        libc6-dev \ 
         \ 
        libx11-dev \ 
    && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=publish /app
ENTRYPOINT ["", "CSharpAspNetCoreDemo"]

1 comment
Anders
Posted on: 23 Apr 2019 07:45

I found that my Dockerfile was wrong. Using the correct file, the report displays very well.

 

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base

WORKDIR /app

RUN apt-get update \ 
    && apt-get install -y \ 
        libc6-dev \ 

        libx11-dev \ 
    && rm -rf /var/lib/apt/lists/*
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /
COPY ["AspNetCoreDemo/CSharpAspNetCoreDemo", "AspNetCoreDemo/"]
RUN restore "AspNetCoreDemo/CSharpAspNetCoreDemo"
COPY .
WORKDIR "/src/AspNetCoreDemo"
RUN build "CSharpAspNetCoreDemo" -c Release -o /app

FROM build AS publish
RUN publish "CSharpAspNetCoreDemo" -c Release -o /app

FROM base AS final

WORKDIR /app
COPY --from=publish /app
ENTRYPOINT ["", "CSharpAspNetCoreDemo"]