ACL altered after using Visual Studio Web Deploy

In some cases you may find that after publishing a project using Web Deploy, the ASPNet IUSR cannot write to the root directory or any files within it (except App_Data). 

By default Web Deploy sets the ACL of the ASPNet IUSR to read only.  To prevent this from causing problems when you publish your application, make one of the following changes (depending on which version of Visual Studio you are using). 

If you have already used Web Deploy to publish your site, please contact support and ask them to reset your ASPNet IUSR's ACL permission.

 

 

For Visual Studio 2010:

Locate the project file. The project file will end with the extension .vbproj for applications written in Visual Basic or .csproj for applications written in C#.  In the project file find:

<propertygroup condition=" '$(Configuration)|$(Platform)' ==
'Release|AnyCPU' "></propertygroup>
Change it to:
<propertygroup condition=" '$(Configuration)|$(Platform)' ==
'Release|AnyCPU' ">
<includesetaclproviderondestination>False</includesetaclproviderondestination></propertygroup>
 

 

For Visual Studio 2012 and later:

First you will need to build your project and create a Publish Profile.

For instructions on how to get started in deploying your site using Web Deploy refer to this Knowledge Base Article:  How do I deploy a Visual Studio 2013 Web Application Project to a Winhost server using Web Deploy or FTP?

Create the Publish profile and save it (do not publish your files until you have modified the publish profile file '.pubxml').

Navigate back to Solution Explorer and go to Properties/PublishProfiles/[Applicaiton Name].pubxml

Input the 'IncludeSetAclProviderOnDestination' setting 'False.'

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
   <IncludeSetAclProviderOnDestination>false</IncludeSetAclProviderOnDestination>
  </PropertyGroup>
</Project>

Reload the project in Visual Studio to clear the cache.