UnauthorizedAccessException with IIS7

I am trying to write a log file from an ASP.NET application in IIS7, but keep getting the following exception:

UnauthorizedAccessException 'Access to path' C: \ Users \ Brady \ Exports' was denied. "

I gave write access to users iis_iusrs, iis_wpg and aspnet based on various tips found by Google, but still got an error. Can someone explain how I can create a log file in this directory, or will create a log directory within the web application itself, automatically allow the file to be written, and is this not the best solution?

+3
source share
3 answers

You need to grant permission to one of the following accounts.

ASPNET - Win XP and Win 2000
NETWORK SERVICE - Win Vista and 2003

, , .

+4

, Mitchel , , , SysInternals Process Monitor (FileMon ), / .

0

If you are impersonating any other user in ASP.NET, this user account must have write permission to this directory. I highly recommend not setting the userโ€™s personal folder path as a location for storing web application logs or data. This requires that the ASP.NET workflow account has access to this private user folder if they do not match the account.

It is recommended to select a common area, for example, D: \ webapps \ logapp \ logfiles. Of course, with the appropriate permissions.

0
source

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


All Articles