Search code examples
asp.net.netiisasp.net-web-apiappdata

I cannot access wkhtmltopdf from my IIS on Windows hosted Web API


I developped an ASP.NET MVC WEB Api, and published it to IIS on my Windows machine. I am using NReco html to image generator inside my code as shown here. Problem is when I run the Action it throws me an exception:

Access to the path 'C:\inetpub\wwwroot\App_Data\wkhtmltoimage' is denied.

I read about this error on the Internet, but could not find anything relatable to my problem. Obviously I need to make a slight configuration change of my IIS to enable access to this App_Data folder, but cannot find the specific setting. Why is there not App_Data folder inside my Publish folder and in Visual Studio it seems that this folder is empty!? How is wkhtmltoimage there after the deploy?

I can see a proposed solution in the green but honestly I cannot understand it.

enter image description here

I read this article, where it is explained how to do so, and publish MANUALY the App_Data folder from Visual Studio, because it was missing, go to c:/inetpub/wwwroot, click properties on it, but I see no ASPNET in my list, see the image below

enter image description here


Solution

  • I gave full control of IIS_IUSRS.