Tag Archives: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005)

[Solved] IIS deployment project access error: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005)

One of my fax sending items can send a fax through the direct console, but when the same code is changed to webapi and deployed to IIS, the fax sent to the interface is directly reported.

System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005)

I thought it was a code writing problem, but it didn’t work

Later, it was found that the problem was IIS

Modify the application pool of webapi, change the project running permission to localsystem, and restart the project!

The reason is analyzed. It is speculated that only if the identity is localsystem, windows will assign permissions to the application to operate hardware related interfaces, such as COM port. Other identities will be considered unsafe.