views:

334

answers:

1

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?


Followup

Currently I'm unable to reproduce the problem I described above. Perhaps I had to restart something or some other unknown factor fixed my problem. The bottom line is that I now can publish a web site using WebDAV.

A: 

1) Open up %windir%\system32\inetsrv\config\schema\WEBDAV_schema

2) Add the following inside of the configSchema section

<sectionSchema name="system.codedom">
  <element name="compilers">
    <collection addElement="compiler" removeElement="remove" clearElement"clear">
      <attribute name="language" type="string" isCombinedKey="true"/>
      <attribute name="extension" type="string" isCombinedKey="true"/>
      <attribute name="type" type="string"/>
      <attribute name="warningLevel" type="int"/>
      <collection addElement="providerOption">
        <attribute name="name" type="string" isUniqueKey="true"/>
        <attribute name="value" type="string"/>
      </collection>
    </collection>
  </element>
</sectionSchema>
sunmorgus
sorry for it being an image, but for some reason the editor was stripping out the xml if I pasted it in there.
sunmorgus
What is the purpose of modifying the schema? Anyway, it seems that my problem has vanished.
Martin Liversage