Asp.net MSDeploy.exe可以作为管理员进行连接,但不能作为任何其他Windows帐户进行连接

Asp.net MSDeploy.exe可以作为管理员进行连接,但不能作为任何其他Windows帐户进行连接,asp.net,iis,iis-7.5,windows-server-2008,webdeploy,Asp.net,Iis,Iis 7.5,Windows Server 2008,Webdeploy,我正在将MSDeploy集成到构建过程中,在身份验证方面遇到问题。以下命令工作正常: msdeploy -verb:sync -source:appHostConfig="KitchenPC",computerName=192.168.0.3,userName=Administrator,password=secret -dest:package=c:\DeployTest\KPC.zip 但是,这不起作用: msdeploy -verb:sync -source:appHostConfig=

我正在将MSDeploy集成到构建过程中,在身份验证方面遇到问题。以下命令工作正常:

msdeploy -verb:sync -source:appHostConfig="KitchenPC",computerName=192.168.0.3,userName=Administrator,password=secret -dest:package=c:\DeployTest\KPC.zip
但是,这不起作用:

msdeploy -verb:sync -source:appHostConfig="KitchenPC",computerName=192.168.0.3,userName=kpcpublish,password=secret -dest:package=c:\DeployTest\KPC.zip
并产生错误:

Error Code: ERROR_USER_NOT_ADMIN
More Information: Connected to '192.168.0.11' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administ
rator on '192.168.0.11'.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
我已经按照上面链接中的说明进行了操作,几乎所有链接都说了同样的话:

  • 我创建了一个名为kpcpublish的帐户
  • 我将此帐户添加到一个名为MSDepSvcUsers的组中-见鬼,我甚至将此帐户添加到Administrators
  • 我右键单击该站点,选择了Deploy->Configure Web Deploy Publishing,并将kpcpublish添加到列表中。它说:
  • 我肯定错过了一些步骤,但我就是不知道会是什么

    更新:

    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'f3a54096-adc4-4f54-9e4f-ad8fde12edb6' for connections to the remote server.
    Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
    More Information: Connected to the remote computer ("staging") using the specified process ("Web Management Service"), but could not verify the server's certifi
    cate. If you trust the server, connect again and allow untrusted certificates.
    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.
    Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    Error: The remote certificate is invalid according to the validation procedure.
    Error count: 1.
    
    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=http://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'ebee66f0-08e5-4d9d-98ea-0c2e59784895' for connections to the remote server.
    Error: Could not complete the request to remote agent URL 'http://staging:8172/msdeploy.axd'.
    Error: The operation has timed out
    Error count: 1.
    
    使用
    computerName
    属性的完整HTTP路径,我得到错误:

    Error Code: ERROR_USER_NOT_ADMIN
    More Information: Connected to '192.168.0.11' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administ
    rator on '192.168.0.11'.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
    Error: The remote server returned an error: (401) Unauthorized.
    Error count: 1.
    
    错误代码:错误\无法到达目的地\详细信息:无法访问 未连接到远程计算机(“192.168.0.3”)。在遥控器上 计算机上,请确保已安装Web Deploy,并且 进程(“Web管理服务”)已启动。了解更多信息,请访问: 无法到达目的地。错误:无法连接到远程服务器 错误:连接尝试失败,因为连接方未连接 一段时间后正确响应,或建立连接 iled,因为连接的主机未能响应192.168.0.3:8192 错误计数:1

    我已经检查过了,Web管理服务确实正在运行

    另一个更新:

    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'f3a54096-adc4-4f54-9e4f-ad8fde12edb6' for connections to the remote server.
    Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
    More Information: Connected to the remote computer ("staging") using the specified process ("Web Management Service"), but could not verify the server's certifi
    cate. If you trust the server, connect again and allow untrusted certificates.
    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.
    Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    Error: The remote certificate is invalid according to the validation procedure.
    Error count: 1.
    
    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=http://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'ebee66f0-08e5-4d9d-98ea-0c2e59784895' for connections to the remote server.
    Error: Could not complete the request to remote agent URL 'http://staging:8172/msdeploy.axd'.
    Error: The operation has timed out
    Error count: 1.
    
    我已经完全铺好了系统,并从头开始重新设置。我没有做任何不寻常的事情,只是安装了IIS角色,并确保选中管理工具下的“管理服务”,这是WMSVC运行所必需的。然后我安装了WebPI,并安装了“主机提供商的推荐配置”,该配置将安装WebDeploy3.0。但是,我确实注意到在安装时出现了一个错误(我相信我上次也遇到了这个错误)。它看起来像:

    我还附上了日志文件

    然后我尝试手动安装WebDeploy3.0,但它说它已经安装。接下来,我直接从下载MSI,并以“修复”模式运行它。这似乎奏效了。我还注意到WMSVC服务已启动并正在运行。这看起来不错

    不过,MSDeploy不会连接。我认为这可能是某种防火墙问题,所以我在本地运行了它。我尝试使用HTTPS和HTTP进行连接。HTTPS给了我一个错误,HTTP只是在2-3分钟后超时

    HTTPS:

    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'f3a54096-adc4-4f54-9e4f-ad8fde12edb6' for connections to the remote server.
    Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
    More Information: Connected to the remote computer ("staging") using the specified process ("Web Management Service"), but could not verify the server's certifi
    cate. If you trust the server, connect again and allow untrusted certificates.
    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.
    Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    Error: The remote certificate is invalid according to the validation procedure.
    Error count: 1.
    
    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=http://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'ebee66f0-08e5-4d9d-98ea-0c2e59784895' for connections to the remote server.
    Error: Could not complete the request to remote agent URL 'http://staging:8172/msdeploy.axd'.
    Error: The operation has timed out
    Error count: 1.
    
    HTTP:

    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'f3a54096-adc4-4f54-9e4f-ad8fde12edb6' for connections to the remote server.
    Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
    More Information: Connected to the remote computer ("staging") using the specified process ("Web Management Service"), but could not verify the server's certifi
    cate. If you trust the server, connect again and allow untrusted certificates.
    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.
    Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    Error: The remote certificate is invalid according to the validation procedure.
    Error count: 1.
    
    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=http://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
    Info: Using ID 'ebee66f0-08e5-4d9d-98ea-0c2e59784895' for connections to the remote server.
    Error: Could not complete the request to remote agent URL 'http://staging:8172/msdeploy.axd'.
    Error: The operation has timed out
    Error count: 1.
    
    更新的2016-03-07-注意:非管理员部署也需要
    ?site=IIS\u site\u NAME
    msdeploy.axd
    之后,否则连接被视为全局连接,需要管理员访问)

    不确定最初是怎么漏掉的,但您的问题是
    computerName
    参数。只有在使用WMSVC时才支持非管理员部署,您需要为其指定完整URL

    试试下面的方法

    msdeploy -verb:sync ^
      -source:appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/MsDeploy.axd,userName=kpcpublish,password=secret,authType=Basic ^ 
      -dest:package=c:\DeployTest\KPC.zip 
    
    :

    计算机名将转换为默认的Web部署URL。例如,computerName=Server1将变为。如果远程服务使用自定义端口或URL运行,则必须指定完整URL

    以及:

    如果未安装Web管理服务,MSI将不会安装Web管理服务处理程序组件;对于非管理员部署,处理程序组件是必需的


    (我找不到一个更明确的规范源,它将WMSVC描述为非管理员部署的需求)

    明白了

    所以,看起来(至少在默认情况下),WMSVC只监听HTTPS,HTTP将超时。但是,由于我的证书是自签名的,所以我必须使用-allowUntrusted命令行选项

    这差不多够了。我还必须像Richard最初建议的那样指定authType=Basic。因此,总而言之,这是MSDeploy命令行,它将实际工作:

    msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=Publish,password=secret -dest:package=c:\DeployTest\KPC.zip -allowUntrusted
    

    尝试在目标计算机上重新启动wmsvc服务

    如上所述,确保您是通过HTTPS连接的。如果您试图以管理员身份连接,但未使用SSL,则会出现以下错误:

    错误代码:错误\用户\非\管理员

    详细信息:已使用Web部署代理服务连接到“主机”,但无法授权。确保您是“主机”上的管理员


    (其中“主机”是您的服务器名)

    配置Web部署我的服务器后。我继续得到连接故障。在五月份,对我起作用的是以下额外的努力

  • 卸载现有的所有早期版本的Web Deploy。我甚至不知道它们的存在;但是,以前的版本似乎与完成到最新Web部署服务的连接冲突。较新版本不会卸载其前代版本。在最后一部分,我得到了
  • 为了更好地衡量,执行了Web Deploy当前版本的修复,当前为Microsoft Web Deploy 3.6
  • 为了更好地测量,请重新创建并导入我的Visual Studio 2013部署配置文件。。。
  • 使用
    IIS管理器
    连接
    面板中目标网站的
    Deploy
    上下文菜单选项提供的
    Configure Web Deploy Publishing
    对话框,重新创建
    发布设置文件。(注意,
    发布设置文件
    将在您按
    设置
    时重新创建,该文件的完整路径在对话框条目中指定,
    指定保存发布设置文件的位置
  • 复制或以其他方式使
    发布设置文件
    可供Visual Studio使用,然后选择