Web API access error after deployment in IIS

I have an MVC Web API application that uses an Excel-related DLL. Microsoft.Office.Interop.ExcelWhen I run the application from VS 2013, it runs under IIS express and I can successfully send a send request through RestClient. But when I deploy this application in IIS, after sending the send request, it gives me the error below.

An unexpected error occurred while servicing your RequestSystem.UnauthorizedAccessException: retrieving the factory COM class for a component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

I have administrator rights on my computer, and I gave all permissions to the folder containing the code. I also added the user IUSRand gave all access to the folder that has my code.

+4
source share
1 answer

After reading the application pool identification document shared by JanneP, I changed the application pool identifier from ApplicationPoolIdentity to LocalSystem, and now the problem has been resolved, and my application works fine in IIS. enter image description here

+2
source

Source: https://habr.com/ru/post/1660277/


All Articles