Web deployment & NAS Devices !!!!
Folks,
This is my first blog and please feel free to comment if you need additional info on the below content :)
So on this post we will be focusing on issues that occur with NAS devices when we deploy using Webdeploy API
The deployment done from Web Deploy APIs to a file share which is on NAS device fails to write or update existing files.
it first "Deletes" the File share content and then Updates the new content which was not expected.
Note : We have a -enableRule:DoNotDeleteRule switch available with Msdeploy but for our case that customer was also deleting some folders through the code and it did not help us.
More information on DoNotDeleteRule is here.
===================================================================================
In one of customer scenario similar to this we found that we have file share on NAS device known ( NetAppStorage Systems). We use webdeploy APIs to deploy content to NAS device.
Also we have console application which uses WEB DEPLOY APIs & it is internally called using another asp.net website which has the User interface to Deploy the content of one server to a file share.
( it was a custom built application to deploy the content via asp.net code to file share directly )
Note : This will also fail if we are deploying using Visual studio or by command line using web deploy tool to a file share ( NAS) device.
We see now with NAS device when we deploy the content first " Deletes the content existing on file share and then Freshly copies new information "
and in 2003 file share or any windows file share it was working fine & not deleting the content and it was running as expected.
The problem started when they Upgraded to use a NAS device and decommissioned windows boxes.
Fix for this Issue :
====================================================================================
If the file system is NTFS, then Web Deploy will rely on the system to keep things sorted. If it isn’t, then Web Deploy will sort it first.
However if the system is not NTFS and for some reason it can’t discover this, then it will assume it’s NTFS.
We figured out from Dev team of webdeploy that connecting to windows files share by default windows file shares will be sorted and content will be upgraded easily but NAS device file structure will not be sorted by
default we need to enable a Registry to force webdeploy to sort before it upgrades the files on NAS share.
By doing a run “dir” from a command line on the NAS to see if everything is in alphabetical order. If it isn’t, then you need to force Web Deploy to do the sorting.
Before the Registry changes we see :
09/25/2014 03:00 PM <DIR> .
09/25/2014 03:00 PM <DIR> ..
09/25/2014 03:00 PM 829 About.aspx
09/25/2014 03:00 PM 171 ApplicationError.htm
09/25/2014 03:00 PM 1,072 Bundle.config
09/25/2014 03:00 PM 545 CheckSite.aspx
09/25/2014 03:00 PM 2,270 Default.aspx
09/25/2014 03:00 PM 32,038 favicon.ico
09/25/2014 03:00 PM 122 Global.asax
09/25/2014 03:00 PM 2,026 packages.config
09/25/2014 03:00 PM 3,507 Site.Master
09/25/2014 03:00 PM 4,632 Web.config
09/25/2014 03:00 PM 1,304 Web.Debug.config
09/25/2014 03:00 PM 1,365 Web.Release.config
09/25/2014 03:00 PM <DIR> bin
09/25/2014 03:00 PM <DIR> Content
09/25/2014 03:00 PM <DIR> Images
09/25/2014 03:00 PM <DIR> Scripts
12 File(s) 49,881 bytes
To do this, you can create a DWORD called “AlwaysSortDirectories” and set it to 1 under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3 in the registry
on Source machine ( on server from where the deployment is happening) in our case IIS server .
By doing the above resolved the issue.
We see After the Registry setting done and restarted the box we see behaviors of files sorting on NAS.
09/25/2014 04:15 PM <DIR> .
09/25/2014 04:15 PM <DIR> ..
09/25/2014 03:00 PM 829 About.aspx
09/25/2014 03:00 PM 171 ApplicationError.htm
09/25/2014 04:15 PM <DIR> bin
09/25/2014 03:00 PM 1,072 Bundle.config
09/25/2014 03:00 PM 545 CheckSite.aspx
09/25/2014 04:15 PM <DIR> Content
09/25/2014 03:00 PM 2,270 Default.aspx
09/25/2014 03:00 PM 32,038 favicon.ico
09/25/2014 03:00 PM 122 Global.asax
09/25/2014 04:15 PM <DIR> Images
09/25/2014 03:00 PM 2,026 packages.config
09/25/2014 04:15 PM <DIR> Scripts
09/25/2014 03:00 PM 3,507 Site.Master
09/25/2014 03:00 PM 4,632 Web.config
09/25/2014 03:00 PM 1,304 Web.Debug.config
09/25/2014 03:00 PM 1,365 Web.Release.config
12 File(s) 49,881 bytes
-- The Dword registry change has fixed the issue of sorting by Web deploy before the content is copied to NAS device.
I hope this helps :)
Irfank