Asp. NET access to the path "xxxxx" solution Summary _ Practical Tips

Source: Internet
Author: User
Under Windows 2003, an error occurred while running the Web application:
The server was unable to process the request,--> denied access to the path "C:/temp/mytest.txt"
Note: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code.

Exception Details: system.unauthorizedaccessexception: Access to the path "D:/temp1/mytest.txt" was denied.

Solution One

Add the Network Service account in the directory where read and write operations are required, because in IIS 6.0, the default application pool is marked with the network service, so the network is used in the process Service This account runs to run the W3wp.exe process, and when we run VS 2003, we need to read and write to a directory, look at the folder, find no network Service, add the account, and select Full Control, Solve the problem.
To do this: right----attribute--security--add--advanced--Find Now--select "Network SERVICE" under "Search results"--OK--OK--OK

Solution Two

The problem can also be resolved by changing the net service to local system in the default application pool--> attribute--> in IIS6.0.

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

Windows 2003 supports both operating modes, and the default is the ISS 6.0 worker process isolation mode. Worker process isolation mode prevents one application or site from stopping and affects another application or site, greatly enhancing the reliability of IIS. So how do you set up two modes of work?

Start IIS Manager, right-click the Web site, select Properties, and open the Properties dialog box (Figure 1). In IIS 6.0 worker process isolation mode, all application code runs in an isolated environment, how are they isolated? Windows 2003 has new application pools, and worker process isolation mode allows customers to create multiple application pools, each of which can have different configurations. Because these application pools receive their requests directly from the kernel rather than the WWW service, performance and reliability are enhanced. To isolate Web applications running on the same computer but belonging to different Web sites, you need to create a separate application pool for each Web site.

Creating an application pool

In IIS Manager, open the local computer, right-click Application pool, and choose New application pool (you must be in worker process isolation mode to establish an application pool). Application Pool Name box, enter a new application pool name. If the ID that appears in the Application pool ID box (such as: AppPool #1) is not what you want, you can rename it. If you clicked use an existing application pool as a template, right-click the application pool that you want to use as a template in the Application pool name box. The last click [OK].

Assigning application Pools

In IIS Manager, right-click the application for which you want to assign an application pool, and then click Properties. Click the Home Directory tab to confirm that the application name of the directory or virtual directory you are assigning is filled in. If the Application Name box has not been filled in, click Create, and then enter a name.

In the Application Pool list box, select the name of the application pool that you want to assign to it. The last click [OK].

A lot of information is queried on the Internet, and the following solutions are available:

1. May be installed the problem, reinstall the execution command, Aspnet_regiis-i, remember to be born
2. Promote everyone's permissions to modifiable
3. Promote the ASPNET permissions: Control Panel-management tools-Computer Management-Local Users and groups find the ASPNET subordinate to the inside plus administrators
4. Delete the IIS virtual directory and rebuild it
5. Add <identity impersonate= "true" in Web.config file/>
6. To grant ASP.net write access to a file, right-click 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 that corresponds to the required access rights.

Everyone add Write permission
7. Save System option settings with XML file, write with ASP.net, debug run (ctrl+f5) normal. Run the error after the site configuration: "Access to Path Xxx.xml is denied". Explorer-> Tools-> Folder Options-> View the use Simple file sharing, right-click the XML file, select "Security" for "attribute" to add "ASPNET", and select "Full Control".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.