我正在使用Visual Studio的Publish按钮来部署我的网站,并希望服务器上有一个不同的App_Data文件夹.有一个复选框Leave extra files on destination (do not delete)可以防止我的App_Data文件夹被删除,但随后它会在网站更改时积累大量的遗留文件.
有没有办法让它在删除所有东西时只排除App_Data?
我有问题MsDeploy将我的网站从Visual Studio发布到远程IIS.
我遇到以下错误:
Microsoft.Web.Delegation.DeploymentAuthorizationException:无法登录用户'.\ WDeployConfigWriter'.---> System.Runtime.InteropServices.COMException:用户名或密码不正确.(来自HRESULT的异常:0x8007052E)---内部异常堆栈跟踪结束---在Microsoft.Web.Deployment.LogonUserHandle.LogonUser(String userName,String domain,String password)
我试着在本地用户和组(lusrmgr.msc)改变WDeployConfigWriter的密码.然后,我打开管理服务代表团.我尝试在WDeployConfigWriter页面的编辑规则中设置凭据,它始终失败,并显示消息"特定密码无效.键入新密码".
我在Windows Server 2012中工作.
任何帮助将是欣赏.谢谢!
我有一个ASP.NET MVC 2应用程序.
当我执行本地构建时,一切都很酷.所有DLL都包含在bin\debug文件夹中.问题是,当我在Visual Studio 2010中使用"发布Web"命令时,它会部署除ExternalAssembly2之外的所有内容.
它似乎忽略了不直接使用的程序集(请记住,ExternalAssembly2仅由ExternalAssembly1使用).
有什么办法可以告诉Visual Studio 2010包含ExternalAssembly2吗?
我可以写一个调用ExternalAssembly2的虚方法.这确实有效,但我真的不想让虚拟代码只是为了让VS2010发布DLL.
deployment build-process visual-studio-2010 msdeploy asp.net-mvc-2
伙计们,
简而言之,我想复制这个对话框:

这是一个Visual Studio 2010 ASP.Net MVC项目.如果我执行此命令,我将获得所需的所有文件,包括"C:\ ToDeploy"目录中的转换后的web.configs.
我想在命令行上复制它,以便我可以将它用于QA环境构建.
我已经在远程部署的命令行上看到了有关如何执行此操作的各种文章,但我只是想为文件系统部署执行此操作.
我知道我可以使用nAnt任务或rake脚本复制这个功能,但是我想用这个机制来做,所以我不重复自己.
我已经对此进行了一些调查,我发现了这些链接,但没有一个能够干净地解决它:
提前致谢!
command-line visual-studio-2010 msdeploy web-publishing msbuild-wpp
我正在尝试在执行发布版本时自动发布我的Web应用程序.我正在使用_CopyWebApplication目标执行此操作.我将以下内容添加到我的.csproj文件中:
<!-- Automatically Publish in Release build. -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<Target Name="AfterBuild">
<RemoveDir Directories="$(ProjectDir)..\Output\MyWeb" ContinueOnError="true" />
<MSBuild Projects="MyWeb.csproj" Properties="Configuration=Release;WebProjectOutputDir=$(ProjectDir)..\Output\MyWeb;OutDir=$(ProjectDir)bin\" Targets="ResolveReferences;_CopyWebApplication" />
</Target>
Run Code Online (Sandbox Code Playgroud)
这有效,但有一个问题.此输出与在Visual Studio中使用"发布"菜单项时生成的输出之间的差异在于,在使用MSBuild方法时,Web.Release.config转换不会应用于Web.config文件.而是复制了Web.config,Web.Release.config和Web.Debug.config.
任何想法都表示赞赏.
我想让web.config转换在本地工作,但显然只在进行部署时才会发生转换.
有没有人知道如何运行msbuild目标"TransformWebConfig"而不通过"rebuild"进程,还指定并输出目录在哪里吐出转换后的web.config?
编辑:使用Sayed的答案,我创建了一个.bat文件来为我运行任务:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Msbuild.exe "D:\Demo\Transformation.proj" /t:TransformWebConfig
copy /Y "D:\Demo\Web.config" "D:\MyProject\Web.config"
del ""D:\Demo\Web.config"
Run Code Online (Sandbox Code Playgroud)
"Transformation.proj"是Sayed的代码片段的副本,在下面的答案中.只需指定转换的源,目标和目标.新文件(在本例中为已转换的"web.config")将位于"D:\ Demo"目录中.我只是将其复制以覆盖我的项目的web.config,最后,删除"demo"文件夹中生成的文件.
另外,我创建了一个宏来运行这个批处理文件并为我执行转换:
Public Module DoTransform
Sub RunTransformBatchFile()
Try
Process.Start("D:\Demo\RunTransform.bat")
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
End Module
Run Code Online (Sandbox Code Playgroud)
您还可以在工具栏上添加一个按钮来运行此批处理和/或指定要执行的快捷键.
asp.net web-config visual-studio-2010 web-deployment msdeploy
我正在尝试msdeploy安装和设置.我已经在Web服务器上安装了远程服务,但我的所有测试都给了我一个401 unauthorised error.服务器是Windows 2008 R2.
我正在测试一个非常简单的msdeploy命令:
msdeploy -verb:dump -source:contentPath=c:\inetpub\wwwroot\MyApp,computerName=<IP HERE>,userName=Domain\msdeploy,password=MyPassword
Run Code Online (Sandbox Code Playgroud)
而错误:
Error: Object of type 'contentPath' and path 'c:\inetpub\wwwroot\MonApp' cannot be created.
Error: Remote agent (URL http://<IP HERE>/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer.
Error: An unsupported response was received. The response header 'MSDeploy.Response' was '' but 'v1' was expected.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
Run Code Online (Sandbox Code Playgroud)
我创建了一个名为msdeploy的用户,并将其添加到服务器上的本地管理员组.
我检查过: …
iis visual-studio-2010 msdeploy msdeployserviceagent webdeploy
我正在尝试复制Visual Studio 2010"发布..."命令(适用于Web应用程序项目),我将在UI中选择发布方法:"文件系统".
我的尝试是......
%msbuild%/ t:MsDeployPublish/property:MsDeployServiceUrl ="file:/// d:\ MyDeploymentFolder"; MsDeployPublishMethod ="File System""d:\ MySourceFolder\Project.csproj"
...并尝试过"FileSystem","File System","Local"等方法.
我得到的错误暗示MsDeploy仍在尝试推送到IIS服务器:
"D:\MySourceFolder\Project.csproj" (MsDeployPub
lish target) (1) ->
(MSDeployPublish target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web
.Publishing.targets(3847,5): error : Web deployment task failed.(The metabase k
ey '/lm/w3svc' could not be found.) [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : \r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : The metabase key '/lm/w3svc' could not be fo
und.\r [D:\MySourceFolder\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.P
ublishing.targets(3847,5): error : Unable to access the IIS configuration …Run Code Online (Sandbox Code Playgroud) 是否可以将文件夹(普通Html文件)的内容部署到远程IIS6/7服务器上的特定Web应用程序?
以下命令不会出错,但也不会将任何文件发布到远程服务器:
msdeploy.exe -verb:sync -source:dirPath="c:\myHtmlFiles" -dest:auto,ComputerName="http://deploy.mycompany.co.uk/msdeploy?site=TestSite",includeAcls="false",username="administrator",password="myPassword" -enableRule:DoNotDeleteRule -disableLink:AppPoolExtension -disableLink:ContentExtension -allowUntrusted
Run Code Online (Sandbox Code Playgroud)
注意:
处理集中配置,应用程序设置和连接字符串,用于多个解决方案,同时还切换到从命令行使用msdeploy来部署Web应用程序.理想情况下,我希望构建一次包,并在将包部署到每个环境时获取最新配置.我需要一些关于最佳方法的建议.
谢谢
msdeploy ×10
msbuild ×3
asp.net ×2
deployment ×2
iis ×2
webdeploy ×2
asp.net-mvc ×1
command-line ×1
msbuild-wpp ×1
web-config ×1