I have installed and configured WebDeploy 2.0 on a (test) server so that WebMatrix and Visual Studio 2010 users can use this to upload their applications to our Windows 2008R2 environments.
This works well with WebMatrix but I encountered a problem deploying an application from Visual Studio 2010. If I click publish and use the WebDeploy method, Visual Studio reports an error and nothing gets published:
So I turned on Failed Request Tracing for the Web Management Service and I see this:
53 AspNetModuleDiagErrorEvent Uri /MsDeploy.axd eventData Tracing
deployment agent exception. Request ID
”. Request Timestamp: ’01/22/2011
00:18:54′. Error Details:
System.UnauthorizedAccessException:
Access to the path ‘d:’ is denied.
at System.IO.__Error.WinIOError(Int32
errorCode, String maybeFullPath) at
System.IO.DriveInfo.get_DriveFormat()
To facilitate use of the WebDeploy feature the delegated management user is granted Full Control of a site’s web folders. This is covered in this article:
No other permissions are mentioned. Given the nature of the error I tried giving the site’s delegated management user Read Attribute
permission on D:
and limited it to This Folder Only
and immediately Visual Studio 2010 is able to publish the application using WebDeploy.
Why is the Visual Studio package behaving differently from WebMatrix on the server?
This is a bug with Visual Studio 2010 which defaults to using the wrong Microsoft.Web.Deployment
assembly (7.1.0.0
).
To overcome this issue an edit needs to be made to VS 2010’s configuration file to force it to use 8.0.0.0
:
C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEdevenv.exe.config
<dependentAssembly>
<assemblyIdentity
name="Microsoft.Web.Deployment"
publicKeyToken="31bf3856ad364e35"
culture="neutral"/>
<bindingRedirect
oldVersion="7.1.0.0"
newVersion="8.0.0.0"/>
</dependentAssembly>
The xml fragment above should be added to:
/configuration/runTime/assemblyBinding
This was confirmed with Microsoft’s PSS group. Apparently Visual Studio 2010 SP1 will address this issue.
Obviously you need MS WebDeploy 2.0 installed on the deployment computer. This can be obtained via the Web Platform Installer or by installing Web Matrix 1.0 RTM which incidentally does the right thing.
Check more discussion of this question.