13

I have a web app (actually Orchard CMS) that I am customizing and I want to push directl from my build server to my hosting provider, using Web Publishing aka MSDeploy.

The problem is, when I publish the site (from Visual Studio, haven't tried it from the build server yet) it removes the write permission from the target web site, which makes Orchard instantly fall over because it can no longer access its database (etc).

We can debate the wisdom of this, but the bottom line is that Orchard requires write access, and web publishing insists on removing that access, which breaks the site. Not good. I have to log in to the service provider's control panel and reset the permissions each time I publish, which kind of makes the process less than automatic.

So, how do I get Web Publishing to leave the ACLs alone? I can't find any settings for this in the solution anywhere.

1
  • This should really be a setting in the publish but web deploy documentation is very patchy. Mar 23, 2016 at 11:04

2 Answers 2

19

You can add turn off the ACL setting functionality by adding this to the .pubxml file:

    <IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination>

See http://msdn.microsoft.com/en-us/library/ff398069.aspx

The article also mentions you can change this for all publish configurations via a local .wpp.targets file. Make sure to consider that option if you use multiple publish configurations

5
  • Interesting - that seems simple enough. What's the difference between this approach and modifying the .csproj file, as suggested by @Paul?
    – Tim Long
    May 29, 2013 at 22:26
  • 1
    Editing the publish file changes that setting for that Publish profile only. Editing the project file changes it for every publish with any profile. There is also a way to change a targets (or similar) file in the visual studio folders that will change this setting for all projects if I recall correctly, but I can't remember where this is. May 29, 2013 at 22:29
  • The doc I linked to in the answer also mentions the .wpp.targets file -- creating that file and putting this setting in it is another alternative if you want to make this setting apply to all profiles rather than just selected profiles.
    – tdykstra
    May 30, 2013 at 17:12
  • 1
    I found it difficult to choose which answer to accept as they are both essentially proposing the same fix. In the end I went with this one because it seems slightly simpler and more flexible and mentions the .wpp.targets file, which I eventually used, and because my follow-up questions were answered. Thank you!
    – Tim Long
    Jul 5, 2013 at 16:19
  • is there a more UI friendly solution? (e.g. a visual studio extension or tool to easily configure this without unload project - edit - reload) Jun 19, 2017 at 14:29
2

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, you will need to locate the project file and make some changes. 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>

and change it to:

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

This will ensure that ACL is not modified by Web Deploy.

If you already deployed to a 3rd party hosting provider, you may need to contact them to get your permissions reset before doing another deployment.

2
  • The site is functional - luckily the hosting provider lets me enable Write permission in the control panel.
    – Tim Long
    May 29, 2013 at 22:25
  • Interesting - that seems simple enough. What's the difference between this approach and modifying the .pubxml file, as suggested by @tdykstra?
    – Tim Long
    May 29, 2013 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.