当我通过 gui(VS2010) 发布 Web 项目时(右键单击项目并选择发布菜单项,发布方法 - Web 部署) - 一切正常。
当我尝试通过命令行发布时出现问题:MSBUILD 或 MsDeploy。
使用 MSBuild 创建包而不发布(仅创建包):
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSbuild.exe" Project.sln /p:DeployOnBuild=true /p:DeployTraget=MSDeployPublish /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl=https://[ip]/msdeploy.axd /p:AllowUntrustedCertificate=true /p:DeployIisAppPath=NlbTestSite /p:UserName=M\DeployUser /p:Password=qwerty
使用 MsDeploy 我得到一个错误:ERROR_USER_UNAUTHORIZED
E:\Work\OutDir\MSDeploy\Package.deploy.cmd" /Y /M:"https://[ip]:8172/msdeploy.axd" /U:"M\DeployUser" /P:"qwerty" -allowUntrusted /A:Basic
我的目标是使用其中一种方法自动化部署过程。
我想了解 Visual Studio 如何发布我的项目(带有什么参数的命令)?
更新 19.10.2012 14:52
当我添加/p:UseMsDeployExe=true
时,msdeploy.exe
执行,但没有复制任何内容。
执行命令:
C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe -source:manifest='E:\[Path]\obj\Debug\Package\[Project].SourceManifest.xml' -dest:package='E:\[Path]\[Project]\obj\Debug\Package\[Project].zip',IncludeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -declareParam:name='IIS Web Application Name',kind='ProviderPath',scope='IisApp',match='^E:\\[Path]\\obj\\Debug\\Package\\PackageTmp$',defaultvalue='[SiteName]',tags='IisApp' -declareParam:name='IIS Web Application Name',kind='ProviderPath',scope='setAcl',match='^E:\\[Path]\\obj\\Debug\\Package\\PackageTmp$' -declareParam:name='Add write permission to App_Data Folder',kind='ProviderPath',scope='setAcl',match='^E:\\[Path]\\obj\\Debug\\Package\\PackageTmp\\App_Data$',description='Add write permission to App_Data folder',defaultvalue='{IIS Web Application Name}/App_Data',tags='Hidden' -declareParam:name='MainModelContainer-Web.config Connection String',kind='XmlFile',scope='E:\\[Path]\\OutDir\\temp\\Web\.config$',match="/configuration/connectionStrings/add[@name='MainModelContainer']/@connectionString",description='MainModelContainer Connection String used in web.config by the application to access the database.',defaultvalue='metadata=[ConnectionString]"',tags='SqlConnectionString' -declareParam:name='SimpleConnection-Web.config Connection String',kind='XmlFile',scope='E:\\[Path]\\OutDir\\temp\\Web\.config$',match="/configuration/connectionStrings/add[@name='SimpleConnection']/@connectionString",description='SimpleConnection Connection String used in web.config by the application to access the database.',defaultvalue='[ConnectionString]',tags='SqlConnectionString' -declareParam:name='ElmahDB-Web.config Connection String',kind='XmlFile',scope='E:\\[Path]\\OutDir\\temp\\Web\.config$',match="/configuration/connectionStrings/add[@name='ElmahDB']/@connectionString",description='ElmahDB Connection String used in web.config by the application to access the database.',defaultvalue='[ConnectionString]',tags='SqlConnectionString' -retryAttempts=2
不传递任何参数,例如计算机名称、用户或密码。关于原因的任何想法?