Wednesday, April 13, 2011

Disable WebDAV in Sitecore

If you are not sure what WebDAV is, please refer to this document on Sitecore Developer Network.
Briefly, quoting this doc:
WebDAV allows users of Web clients such as browsers to manage files on Web servers using Web protocols such as HTTP or HTTPS. With WebDAV, users can drag-and-drop files between the Windows desktop and the browser.
I would recommend disabling this feature on the Content Delivery side as WebDAV is not expected to be used there.

It also makes sense disabling this feature on the CMS side if you are not planning on leveraging this feature at all. This will reduce the number of log files written to the /data/logs folder and get rid of the errors in the main log files generated if WebDAV is misconfigured.
Here are the steps:
1. Remove WebDAV config references within <log4net />:
   1: <log4net> 
   2: <appender name="LogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> 
   3: <file value="$(dataFolder)/logs/log.{date}.txt" /> 
   4: <appendToFile value="true" /> 
   5: <layout type="log4net.Layout.PatternLayout"> 
   6: <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> 
   7: </layout> 
   8: </appender> 
   9: <!--<appender name="WebDAVLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> 
  10: <file value="$(dataFolder)/logs/WebDAV.log.{date}.txt" /> 
  11: <appendToFile value="true" /> 
  12: <layout type="log4net.Layout.PatternLayout"> 
  13: <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> 
  14: </layout> 
  15: </appender>--> 
  16: <root> 
  17: <priority value="INFO" /> 
  18: <appender-ref ref="LogFileAppender" /> 
  19: </root> 
  20: <!--<logger name="Sitecore.Diagnostics.WebDAV" additivity="false"> 
  21: <level value="INFO" /> 
  22: <appender-ref ref="WebDAVLogFileAppender" /> 
  23: </logger>--> 
  24: </log4net> 
2. Remove WebDAV config references within <system.webServer />:
   1: <!--<remove name="WebDAVModule" />-->
   3: <!--<add name="WebDAVRoot" path="*" verb="OPTIONS,PROPFIND" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
   4: <add name="WebDAVRoot64" path="*" verb="OPTIONS,PROPFIND" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
   5: <add verb="*" path="sitecore_webDAV.ashx" type="Sitecore.Resources.Media.WebDAVMediaRequestHandler, Sitecore.Kernel" name="Sitecore.WebDAVMediaRequestHandler" />-->
3. Remove WebDAV config references within <httpHandlers>/>:
   1: <!--
   2: <add verb="*" path="sitecore_webDAV.ashx" type="Sitecore.Resources.Media.WebDAVMediaRequestHandler, Sitecore.Kernel" />
   3: -->
4. Finally, you can delete the Sitecore.WebDAV.config file from webroot/App_Config/Include.
There you go!


Mark Ursino said...

Good simple tip Alex. In a more general sense, do you have your own checklist you run down a lot when you begin a new solution? For example, specific things you enable or disable in CM and CD instances all the time? E.g. removing the master DB from CD sites, removing the system index if not used, etc.

Sergey Marchenko said...

Can't we just change "WebDAV.Enabled" setting to "false"?

Unknown said...

Hi Sergey,

I have tried that but the WebDAV logs are still generated, empty though.

This is definitely an option that I should have specified as least intrusive.


Unknown said...

Hi Mark,

I am using a combination of the items from the Scaling Guide, specifically to remove the references to the master database. Also, there is a great checklist available here.
Disabling search index, performance counters, etc. really help getting a faster system in development.

Hope it helps.

Pankaj said...

Good post, exactly what I was looking for :)

I think its best to remove config for features you are not using. It keeps the config files clean and clear.