Summary of ASP.NET solutions for denied access to path 'xxxxx'

  • 2020-05-17 05:18:04
  • OfStack

Under windows 2003, 1 error occurred while running the web application:
The server could not process the request, -- > denied access to the path "C:/temp/ mytest.txt"
Note: during the execution of the current Web request, an unhandled exception occurred. Check the stack trace information for more information about this error and the source of the error in the code.

Exception details: System UnauthorizedAccessException: the path "D: / temp1 MyTest txt" access denied.

Solution 1

Add to read and write operations on the directory Network Service this account, because in iis 6.0, the label with the default application pool is Network Service, so in the process is to use Network Service this account run to run w3wp. exe process, and when we are in the running VS 2003 need to read and write operations, a 1 directory to see the folder under 1, found no Network Service, Add the account and select FULL CONTROL at the same time. Problem solved.
Specific process: right click on the folder - property - security - add - senior - immediately find - under "search results" to choose "NETWORKSERVICE" -- sure, sure, sure

Solution 2

Default application pool -- in IIS 6.0 > Attributes - > The problem can also be solved by changing Net Service to Local System.

What is an application pool? This is a new concept from Microsoft: an application pool is a configuration that links one or more applications to a collection of one or more worker processes. Because applications in the application pool are separated from other applications by worker process boundaries, applications in one application pool are not affected by problems caused by applications in other application pools.

Windows 2003 supports both working modes, and ISS 6.0 work-process isolation mode is the default. The worker process isolation mode prevents one application or site from stopping and affecting another, greatly increasing the reliability of IIS. So how do you set up the two modes of operation?

Launch the IIS manager, right-click the website, select properties, and open the properties dialog (figure 1). In IIS 6.0 worker process isolation, all application code runs in an isolated environment. How are they isolated? Windows 2003 added application pools, and the worker process isolation mode allows customers to create multiple application pools, each of which can be configured differently. Because these application pools receive their requests directly from the kernel, rather than WWW services, performance and reliability are enhanced. To isolate Web applications running on the same computer but belonging to different sites, you need to create a separate application pool for each site.

Create application pools

In IIS manager, open your local computer, right-click application pool, and select new application pool (you must be in worker process isolation mode to create the application pool). In the application pool name box, enter a new application pool name. If the ID (e.g., AppPool #1) that appears in the application pool ID box is not what you want, rename it. If you click use existing application pools as templates, right-click the application pools you want to use as templates in the application pool name box. Finally click ok.

Assign application pools

In IIS manager, right-click the application for which you want to assign application pools, and then click properties. Click the home directory TAB to confirm that the application name of the directory or virtual directory you are assigning has been filled in. If the application name box has not been filled in, click create and enter a name.

In the application pool list box, select the name of the application pool you want to assign to it. Finally click ok.

After searching for a lot of information on the Internet, there are several solutions as follows:

1. There may be a problem with the installation. Reinstall the command aspnet_regiis-i
2. Upgrade the permissions of everyone to modifiable
3. Enhance aspnet permissions: control panel - management tools - computer management - local users and groups find ASPNET belonging to the inside plus Administrators
4. Delete the iis virtual directory and rebuild it
5. Add in web.config file < identity impersonate="true"/ >
6. To grant write access to a file to ASP.NET, right click on the file in explorer, select properties, and then select the security TAB. Click add to add the appropriate user or group. Highlight the ASP.NET account and select the box for the required access rights.

everyone plus write permissions
7. Save system option Settings with xml file, write with asp.net, debug and run (ctrl+F5) normally. An error was reported when the site was configured to run: "access to path xxx.xml was denied". Resource manager - > Tools - > Folder options - > To see if "use simple file sharing" is not selected, right click on xml file, select "properties" point "security" to add "aspnet", and select "full control".

Related articles: