How to upload web.config file using WebDAV on IIS7?
Posted
by Martin Liversage
on Stack Overflow
See other posts from Stack Overflow
or by Martin Liversage
Published on 2010-03-08T23:02:57Z
Indexed on
2010/03/08
23:06 UTC
Read the original article
Hit count: 1024
I want to copy an ASP.NET MVC website to a remote IIS 7 server using WebDAV. I have created a site in IIS, enabled WebDAV and assigned a special application pool I have named "WebDAV Application Pool". Using a Windows 7 or Vista client I'm able to mount the remote site as a network drive. So far, so good.
However, I have problems uploading web.config
files to the remote site. One problem is that as soon as a web.config
has been uploaded it is used to configure the WebDAV site. The web.config
file in a Views
folder of a MVC project effectively blocks access to that folder.
To work around this problem I have configured the application pool in the applicationHost.config
file:
<configuration>
<applicationPools>
<add name="WebDAV Application Pool"
autoStart="true"
enableConfigurationOverride="false" />
</applicationPools>
</configuration>
The interesting part is the 'enableConfigurationOverride` attribute:
When true, indicates that delegated settings in Web.config files will processed for applications within this application pool. When false, all settings in Web.config files will be ignored for this application pool.
Doing this makes it possible to upload a web.config
file to the Views
folder without breaking access to the folder.
However, I'm still unable to upload a web.config
file to the root folder. I have the following settings in the applicationHost.config
file to ensure that request filtering doesn't interfere with WebDAV:
<configuration>
<location path="webdav.mysite.tld">
<system.webServer>
<security>
<requestFiltering>
<fileExtensions applyToWebDAV="false" />
<verbs applyToWebDAV="false" />
<hiddenSegments applyToWebDAV="false" />
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
In particular hiddenSegments
will normally block access to web.config
but setting the applyToWebDAV
attribute to false should ensure that this file isn't blocked when using WebDAV.
Unfortunately, I'm still unable to copy my web.config
file to the root folder of the site. Doing drag and drop in Windows Explorer to the mapped WebDAV network drive will result in the following error message:
Error 0x80070057: The parameter is incorrect.
On the wire it seems that the HTTP status 400 Bad Request
is returned.
Is there anything I can do to configure WebDAV on IIS 7 to avoid this problem?
© Stack Overflow or respective owner