title: Rotativa.AspNetCore not working after deployment in smarterasp
body: <p>In my latest NetCore(2.0) project I am using Rotativa.AspNetCore, everything worked fine(locally) since I published it to SmarterAsp.</p>
  
  <p>The main problem is that when I'm trying to generate PDF file through my api, the action is not working, is returning an error:</p>
  
  <blockquote>
    <p>Requested page not found. [404]</p>
    
    <p>XML Parsing Error: no root element found</p>
    
    <p>Location: <a href="https://.../api/file/MembershipRegistrationApplication" rel="nofollow noreferrer">https://.../api/file/MembershipRegistrationApplication</a></p>
    
    <p>Line Number 1, Column 1:</p>
  </blockquote>
  
  <p>Error image:</p>
  
  <p><a href="https://i.stack.imgur.com/J5WAg.jpg" rel="nofollow noreferrer">https://i.stack.imgur.com/J5WAg.jpg</a>
  <a href="https://i.stack.imgur.com/XWFJo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWFJo.jpg" alt="enter image description here"></a></p>
  
  <p>Here is my code </p>
  
  <pre><code>[HttpPost]
  [AllowAnonymous]
  [Route("/api/file/MembershipRegistrationApplication")]
  public async Task&lt;byte[]&gt; MembershipRegistrationApplication([FromBody] RegisterViewModel model)
  {
      var education = new List&lt;Education&gt;();
  
      education.Add(_educationService.IncludeEducation(model.Education));
  
      var user = new ApplicationUser
      {
          Email = model.Email,
          PhoneNumber = model.PhoneNumber,
          BirthDate = model.BirthDate,
          Address = model.Address,
          PlaceOfBirth = model.PlaceOfBirth,
          MunicipalityOfBirthId = model.MunicipalityId,
          IsMale = model.IsMale,
          FathersName = model.FathersName,
          LastName = model.LastName,
          MaritalStatusId = model.MaritalStatusId,
          CitizenshipId = model.CitizenshipId,
          MunicipalityId = model.MunicipalityId,
          FirstName = model.FirstName,
          NationalityId = model.NationalityId,
          PersonalNumber = model.PersonalNumber,
          ForeignMunicipalityOfBirth = model.ForeignMunicipalityOfBirth,
          Educations = education,
          MaidenName = model.MaidenName
      };
  
      user = _accountService.IncludeApplicationUser(user);
      return await _pdfGenerator.GenerateMembershipApplication(user);
  }
  </code></pre>
  
  <p>GenerateMembershipApplication method code </p>
  
  <pre><code>public async Task&lt;byte[]&gt; GenerateMembershipApplication(ApplicationUser user)
  {
      var httpContext = new DefaultHttpContext { RequestServices = _serviceProvider };
      var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
  
      var bytePDF = new Rotativa.AspNetCore.ViewAsPdf("File/MembershipApplication", user)
      {
          PageMargins = { Top = 10, Right = 1, Bottom = 1, Left = 20 },
          FileName = string.Concat("MembershipApplication", ".pdf")
      }.BuildFile(actionContext);
  
     return await bytePDF;
  }
  </code></pre>
  
  <p>and ajax call</p>
  
  <pre><code>$.ajax({
      url: "/api/file/MembershipRegistrationApplication",
      type: 'post',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      data: JSON.stringify(model),
      success: function (data) {
          var pdfAsDataUri = "data:application/pdf;base64,"+data;
          window.open(pdfAsDataUri);
      },
      error: function (jqXHR, exception) {
          var msg = '';
          if (jqXHR.status === 0) {
              msg = 'Not connect.\n Verify Network.';
          } else if (jqXHR.status == 404) {
              msg = 'Requested page not found. [404]';
          } else if (jqXHR.status == 500) {
              msg = 'Internal Server Error [500].';
          } else if (exception === 'parsererror') {
              msg = 'Requested JSON parse failed.';
          } else if (exception === 'timeout') {
              msg = 'Time out error.';
          } else if (exception === 'abort') {
              msg = 'Ajax request aborted.';
          } else {
              msg = 'Uncaught Error.\n' + jqXHR.responseText;
          }
          console.log(msg);
      }
  });
  </code></pre>
  
  <p>First I thought that the problem is with data that are being posted by ajax  call(I tried also with formData,but still the same error) and after many hours trying to figure out what is happening I found that the cause of error  was Rotativa.Another reason why I think that Rotativa is causing the problem is that other APIs that dont relate to pdf generation process work perfectlly.</p>
  
  <p>My Rotativa folder also has necessary files,</p>
  
  <ul>
  <li>help-wkhtmltoimage.txt</li>
  <li>help-wkhtmltopdf.txt </li>
  <li>msvcp120.dll </li>
  <li>msvcp140.dll</li>
  <li>msvcr120.dll </li>
  <li>vcruntime140.dll </li>
  <li>wkhtmltoimage.exe </li>
  <li>wkhtmltopdf.exe
  wkhtmltox.dll</li>
  </ul>
  
  <p>Does anyone have any idea or any suggestion what should I do to solve this problem?</p>