简体   繁体   中英

ASP.NET Access to the path denied, on Web Server

I am having a problem, that is when I deployed my asp.net 4.0 application on my web server i am unable to write to App_Data folder. Actually it has an xml file which I am trying to write some information into. I am getting the following error.

Access to the path 'C:\HostingSpaces\hosterind\mydomain.com\wwwroot\App_Data\ErrorLog.xml' is denied.

I tried searching every corner for a possible solution before posting on stackoverflow but i am unable to fix this. Searching similar questions on internet (stackoverflow too) i concluded that i need to handle it through IIS as everywhere it was quoted on internet to grant permission to App_Data folder through IIS Manager. As accessing IIS Manager of your web hosting server is impossible, i supposed people are referring to my local IIS server. So, i copied my project which i was developing in visual studio from location: C:\\Users\\DanComputer\\Documents\\Visual Studio 2010\\WebSites\\MyWebProject and pasted into C:\\inetpub\\wwwroot. Then i located my project in IIS Manager by selecting DefaultAppPool as application pool. I changed my App_Data folder permission to allow full control for IIS_IUSRS(DanComputer\\IISUSRS). Then i copied my App_Data folder to my web hosting space using ftp software but it didn't solve my problem. I tried many thing even changing permission to allow full control for everyone but it did't work and i am still getting the same error. Any help please?

You need to know what is the identity of the Application Pool of your app. You can get this information from IIS or console. It is possible that your hosing company may have a control panel that can give you that information.

在此输入图像描述

Then you need to give permissions to the account in the app pool identity the names will be the same or at least be very similar to what you saw in IIS:

在此输入图像描述

So using my examples above I will have to give permissions to Local Service or Network Service to read/write my app_data folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM