I have used this component to generate a pdf document based out of a dynamic view content. On testing at DEV and Staging environment, it worked fine and on Production environment, it throws below shown error.
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Rotativa Version: 1.0.0.0
System.Web.Mvc Version: 5.2.3.0
I have given the binding redirect in web.config as below.
bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"
Code:
var pdfLetter = new Rotativa.ViewAsPdf(viewName, viewModel);
pdfLetter.FileName = fileName;
pdfLetter.PageSize = Rotativa.Options.Size.A4;
pdfLetter.PageOrientation = Rotativa.Options.Orientation.Portrait;
pdfLetter.PageMargins = new Rotativa.Options.Margins { Left = 4, Right = 1 };
var letterBytes = pdfLetter.BuildPdf(ControllerContext);
return letterBytes;
Web Application is not referencing the 3.0.0.1 version anywhere and still it throws the error. Tried to check the available Stack Overflow threads to fix.
Does anyone encountered this same problem and have any workaround to fix?