简体   繁体   中英

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.

在此处输入图片说明

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

在此处输入图片说明

In IIS Manager, Go to Application Pools, select Advanced parameters. Right click the application pool, you'll see the identity of your pool.

You must grant access to this pool identity. In the permissions of the folder App_Data, Add the user "IIS AppPool\\YourApplicationPoolIdentity".

And it should do the stuff.

我完全控制了IIS_IUSRS。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM