IIS write permissions to web root - iis

I created IIS website with following setting (ApplicationPool account is named Fitko)
When I run website and submit form with image, application throw an error
UnauthorizedAccessException: Access to the path
'C:\IISWorkspace\Fitko\upload\instructors' is denied.
System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
I gave full permissions to Fitko folder to these accounts
IUSR
Users
Administrators
network service
IIS AppPool\Fitko
yet still the UnauthorizedAccessException exception still throwing.
How can I give access permissions to IIS to write to the folder ?

I solve the issue by enabling windows authentication (I had Anonymous Authentication before, but probably it can be enabled together)
the setting is in
Web Project > Properties > Debug > Web Server Settings
and the flag seems to takes control even when the publish configuration is set to release.

In my opinion, the issue typically indicates a permission error of the specific folder.
What is your Application pool identity? try to right-click the folder and grant Everyone Account full access to the folder.
Besides, under certain cases, this might relate to our website framework technology.
https://github.com/stryker-mutator/stryker-net/issues/272
Feel free to let me know if the problem still exists.

In internet service manager right click on the default website, click on edit permission, click on the security tab the click on edit
Add built-in ISUR account to the website and give the appropriate access
and or add built in IIS_IUSERS account and do the same if the above does not work.

Related

Configuring Web Deploy IIS User premissions

I successfully configured IIS for Web Deploy and added a IIS Manager User.
The problem is when i try to publish, i get back error
Error 1 Web deployment task failed. (Unable to perform the operation
("Delete Directory") for the specified directory ("2_0_50727"). This
can occur if the server administrator has not authorized this
operation for the user credentials you are using. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.) C:\Program
Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets 4270 5 WebAPI
Which shortly means, there are no premissions for user to handle root folder content. I couldn't figure out, who is the user, to give the permissions to.
The linked Microsoft page is telling, in most of the case, it's "Local Service", well it already has full control permissions. So i tried more "IUSR", "DefaultAppPool" - still not right ones. The temporary solution is to give permissions to "Everyone" and then it works... but who's the right user??
Did you add a rule (contentPath, createApp, dirPath, filePath, iisApp, runCommand) for your IIS Manager user in Manager Service Delegation?
And also I granted access to the site folder for LOCAL SERVICE because Web Management Service runs under this account and for NETWORK SERVICE because of Web Deployment Agent Service.
Right click the web site in IIS Manager and choose Deploy -> Configure Web Deploy Publishing. Choose your IIS-user and Setup, in order to give correct rights for publishing to that site.

IIS_IUSRS and IUSR permissions in IIS8

I've just moved away from IIS6 on Win2003 to IIS8 on Win2012 for hosting ASP.NET applications.
Within one particular folder in my application I need to Create & Delete files. After copying the files to the new server, I kept seeing the following errors when I tried to delete files:
Access to the path 'D:\WebSites\myapp.co.uk\companydata\filename.pdf' is denied.
When I check IIS I see that the application is running under the DefaultAppPool account, however, I never set up Windows permissions on this folder to include IIS AppPool\DefaultAppPool
Instead, to stop screaming customers I granted the following permissions on the folder:
IUSR
Read & Execute
List Folder Contents
Read
Write
IIS_IUSRS
Modify
Read & Execute
List Folder Contents
Read
Write
This seems to have worked, but I am concerned that too many privileges have been set. I've read conflicting information online about whether IUSR is actually needed at all here. Can anyone clarify which users/permissions would suffice to Create and Delete documents on this folder please? Also, is IUSR part of the IIS_IUSRS group?
Update & Solution
Please see my answer below. I've had to do this sadly as some recent suggestions were not well thought out, or even safe (IMO).
I hate to post my own answer, but some answers recently have ignored the solution I posted in my own question, suggesting approaches that are nothing short of foolhardy.
In short - you do not need to edit any Windows user account privileges at all. Doing so only introduces risk. The process is entirely managed in IIS using inherited privileges.
Applying Modify/Write Permissions to the Correct User Account
Right-click the domain when it appears under the Sites list, and choose Edit Permissions
Under the Security tab, you will see MACHINE_NAME\IIS_IUSRS is listed. This means that IIS automatically has read-only permission on the directory (e.g. to run ASP.Net in the site). You do not need to edit this entry.
Click the Edit button, then Add...
In the text box, type IIS AppPool\MyApplicationPoolName, substituting MyApplicationPoolName with your domain name or whatever application pool is accessing your site, e.g. IIS AppPool\mydomain.com
Press the Check Names button. The text you typed will transform (notice the underline):
Press OK to add the user
With the new user (your domain) selected, now you can safely provide any Modify or Write permissions
IUSR is part of the IIS_IUSER group, so I guess you can remove the permissions for IUSR without worrying. Further reading
However, a problem arose over time as more and more Windows system services started to run as NETWORKSERVICE. This is because services running as NETWORKSERVICE can tamper with other services that run under the same identity. Because IIS worker processes run third-party code by default (Classic ASP, ASP.NET, PHP code), it was time to isolate IIS worker processes from other Windows system services and run IIS worker processes under unique identities.
The Windows operating system provides a feature called "Virtual Accounts" that allows IIS to create unique identities for each of its Application Pools. DefaultAppPool is the default pool that is assigned to all Application Pools you create.
To make it more secure you can change the IIS DefaultAppPool Identity to ApplicationPoolIdentity.
Regarding permissions, Create and Delete summarize all the rights that can be given. So whatever you have assigned to the IIS_USERS group is all that they will require.
When I added permissions for IIS_IUSRS to the site folder, resources like JavaScript and CSS were still inaccessible (error 401, forbidden). However, when I added IUSR, it started working. So for sure you cannot remove the permissions for IUSR.
#EvilDr
You can create an IUSR_[identifier] account within your AD environment and let the particular application pool run under that IUSR_[identifier] account:
"Application pool" > "Advanced Settings" > "Identity" > "Custom account"
Set your website to "Applicaton user (pass-through authentication)" and not "Specific user", in the Advanced Settings.
Now give that IUSR_[identifier] the appropriate NTFS permissions on files and folders, for example: modify on companydata.
IIS_IUSRS group has prominence only if you are using ApplicationPool Identity. Even though you have this group looks empty at run time IIS adds to this group to run a worker process according to microsoft literature.
I would use specific user (and NOT Application user). Then I will enable impersonation in the application. Once you do that whatever account is set as the specific user, those credentials would used to access local resources on that server (Not for external resources).
Specific User setting is specifically meant for accessing local resources.

Cannot read configuration file due to insufficient permissions

I am trying to test my Web Service on an IIS instance on my local machine before I promote to a windows server 2008 environment. I get this when I attempt to browse to the service. I have created a custom application pool that this service will run under btw. So I am guessing that that application ID does not have permissions to access that folder etc... I get this little detail btw...
"This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error."
I am thinking I need to give that application identity permissions, but I am unsure how to accomplish this.
Is there another way to get this done?
Not sure whether this is too late for you.
The IIS website is run by either USERS or IIS_IUSRS.
Try to do following:
From Windows Explorer
Right click on the folder pointed by the web
Go to security tab
Add computername\IIS_IUSRS or computername\USERS with Read permission.
1.Open IIS
2.On left side panel click on application pools
3.And go to its properties and change identity value from "ApplicationPoolIdentity" to "Local System".
I resolved the problem when i tried this.
I faced a similar issue on Windows 8.1. I fixed it by changing identity value from ApplicationPoolIdentity to Local System.
Check your sites Security -> Authentication feature. If anonymousAuthentication is enabled, click on the Edit link (in the Actions column) to see which identity is being used; if it is IUSR, make sure IUSR has FileSystem ACL privileges on the website's folder and files. If it set to 'ApplicationPoolIdentity' make sure group IIS_IUSRS has the same rights, because the 'ApplicationPoolIdentity' is dynamically added to the IIS_IUSRS group at runtime.
Modifying the application's identity setting from "ApplicationPoolIdentity" to "LocalSystem" on IIS(7) solved my issue. when adding permission to the IIS_IUSRS did not. I don't quite understand why though.
For me, I just transferred my files under c:\inetpub\wwwroot and the error is gone.
All I had to do was edit permissions for the virtual directory(application) in IIS 7.5 and add IUSR to the permissions. That fixed it.
If you chosen old version of .Net framework in application pool of IIS may sometimes cause this issue. So Try with higher .net framework version.

IIS 7 and 503 error for file copy access denied problem

I'm running Windows 7 SP 1 and have just turned on IIS 7. Just trying to access the default page it creates I get a 503 error, and the application pool stops. I look in the event log and I find the error:
Windows cannot copy file \?\C:\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm to location \?\C:\Users\TEMP.IIS APPPOOL.000\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm. This error may be caused by network problems or insufficient security rights.
DETAIL - Access is denied.
I tried making the TEMP.IIS APPPOOOL.000 folder available to everyone. I tried making Users available to everyone. No luck, it still dies with the same error.
What is happening here, and how can it be fixed?
It sounds like you're having the same problem as details in this IIS.NET forums thread. You didn't mention if you have x64 Windows 7 or not. Suspect that your development machine is misconfigured somehow; sounds like the uninstallation and reinstallation of IIS7 would help/fix.
Suggested courses of action:
Open IIS and its Application Pools. Open "DefaultAppPool" and any other Application Pools in use.
Click Advanced Settings for each of these. Ensure the "Load User Profile" is set to 'False'
Also ensure that the "Set Application Pool Defaults" has the Load User Profile set to False."
I encountered the same problem in my development environment (Windows 8.1). Instead of disabling the load user profile as suggested by P.Campbell, I went ahead and changed the permission of the sqm file to allow modify accesses for IUSR, IIS_IUSRS and Network Service. In my case, the sqm file was not able to show me the file owner in which I taken over with my user account.
Basically, my problem was solved by giving the correct permission for both source and destination files/folders.
Found the answer here - http://forums.iis.net/p/1180636/1992024.aspx
Open IIS Manager
Find the App Pool that is causing the problem
Open Advanced Properties
Change 'Load User Profile' to false
Fixed!
After struggling with all these Application Pool issues in IIs, I found the problem and the solution. This may help you.
Each application pool on each website in Microsoft's Internet Information Server creates its own user account and folder under the "c:\Users" directory when the pool is created and first run. Its actually a virtual user account and should be named for the Application Pool assigned to your web application in IIs. In most development environments, its the default website or "DefaultAppPool". It uses this temporary user account to run the pool. Each website should have a named user pool account. This User folder is used by the pool and ASP.NET for caching and writing of file resources and other things used by IIs, ASP.NET, and this virtual account.
In some setups people are not seeing this folder but a "TEMP" folder (like you have) when the IIs web site is accessed and using the pool.
If you instead see a "TEMP" folder in the Users folder you have a broken application pool account in IIs and in the Registry. The pool is creating the TEMP folder as a backup for this virtual account, which might not have the right security setup. I had this exact scenario.
To fix it go to the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
See if you have a SID user account with the ".bak" extension for a DefaultAppPool user account. If so delete it and restart your PC. Test your website again, making sure its actually setup to use DefaulAppPool. It should now recreate the "DefaultAppPool" folder in Users, recreate the registry entry for DefaulAppPool user, and your error should go away.
You can delete the TEMP user folder at that point under the Users folder. (Keep in mind if your web app has been storing cached information critical to users of the website, some of that might have to be inserted into the new DefaultAppPool user folder. But for most of us, just delete it.)
I also found I had to add this kooky virtual application pool account to my local database so the worker process and app pool accnt could have the rights to grab data from SQL Server: Just go into SQL Server and under logins add "IIs AppPool\DefaultAppPool" and then assign it as a user to your databases.
(btw whomever dreamed up this virtual application pool account system is nuts....its way too complicated and convoluted to sort out)
After I did this, all my stack overflow errors went away in Visual Studio for my web application, all data connections fired perfectly, all write permission to the default User profile stored properly, and all the restarting and crashing of the Application Pool in IIs ended completely. :)

Impersonate in Classic ASP

Preparing for the migration of asp-application with Windows 2000 (web1) on Windows 2003 (web2).
On the old server has a folder to share documents, use for imports and exports (\ \ web1 \ folder). I want to provide access to the same folder access asp-application with the new server.
Configuration IIS: anonymous access is allowed, including checking windows. Pool started under the Network Service.
But there is no access.
And there is an interesting fact: if handled locally with the new server as http://localhost, you have access (impersonation works), if handled as http://web2, then there is no access. Error:
Microsoft VBScript runtime error Error '800a0046 '
Permission denied
We some changed security settings, local IE 6 - earned through http://web2 too, but in other browsers (like Opera) does not work. On other machines does not work either.
Put utility procmon from SysInternal. It shows that in both cases is an appeal to the resource, in both cases is impersonation, all the same, but in one case, SUCCESS, and the other ACCESS DENIED.
The entire security system of this application is based on the rights of NTFS, so you can not disable impersonation.
I'm newby in classic asp. I can not understand this case.
Classic ASP does not run under Application Pool account, credentials provided in IIS Anonimous Authenctication tab used instead, usually it is IUSR_MACHINENAME.
Looks like the anonymous authentication fails and Windows authentication used, this is the reason it works locally and in IE which supports Windows authentication by default.
UPDATE: Check this article: How to troubleshoot Kerberos-related issues in IIS
UPDATE 2: Also this can help you diagnose what's going on on IIS side: Authentication and Access Control Diagnostics
I guess the simplest way to access share is to add read permission to Guests group.
you can change the user of the anonymous authentication to be the app pool user , i tested it and it works !
go to iis -> web site \ virtual directory -> authentication -> choose anonymous -> edit -> change user identity to application pool user
screenshot:

Resources