Web 部署代理可以在 IIS6 上的 80 以外的端口上运行吗?

发布于 2024-11-04 09:09:15 字数 351 浏览 0 评论 0原文

我在使用 Windows 2003 机器时遇到了一些挑战,我需要在非 80 的端口上运行 Web 部署代理。默认情况下,MsDepSvc 将在 http://[server]/MsDeployAgentService 公开端点它显然隐式侦听端口 80。

我遇到的问题是该计算机还运行使用端口 80 的 Visual SVN Server,因此 Web 部署代理服务拒绝启动。 (至少这是我能得出的唯一合乎逻辑的结论。)我在同一台机器上有一个小型 SVN 管理应用程序,我想通过 Web 部署发布它,因此出现了难题。

是否可以在另一个端口上运行代理?显然,如果这是 IIS7,我们将使用 8172,一切都会很好,但不幸的是,这里的情况并非如此。有什么建议吗?

I've got a bit of a challenge with a Windows 2003 machine where I need to run the web deploy agent on a port which isn't 80. By default, MsDepSvc will expose an endpoint at http://[server]/MsDeployAgentService which obviously implicitly listens on port 80.

The problem I have is that the machine is also running Visual SVN Server which is using port 80 and as a result, the web deployment agent service refuses to start. (At least this is the only logical conclusion I can draw.) I have a small SVN management app on the same machine which I'd like to publish over web deploy hence the conundrum.

Is it possible to run the agent on another port? Obviously if this was IIS7 we'd be on 8172 and everything would be fine but unfortunately that's not the case here. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

放低过去 2024-11-11 09:09:16

有几种方法可以执行此操作:

选项 1:卸载并重新安装指定不同的端口:

msiexec /I WebDeploy_x86_en-US.msi /passive ADDLOCAL=ALL LISTENURL=http://+:8172/MsDeployAgentService

命令行安装 MsDeployAgentService 并将其配置为侦听端口 8172,就像在 IIS7 上一样。

选项 2:重新配置现有服务以侦听端口 8172:

  1. 停止 msdepsvc (net stop msdepsvc)

  2. 编辑以下注册表值:

    HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters\ListenUrl
    

    它看起来像:

    http://+:80/MsDeployAgentService
    

    更改为:

    http://+:8172/MsDeployAgentService
    
  3. 查询 HTTP 侦听器:

    httpcfg 查询 urlacl
    

    您应该会看到结果中列出以下条目:

    URL:http://+:80/MsDeployAgentService/
    ACL : D:(A;;GX;;;NS)
    
  4. 修改侦听器:

    httpcfg 删除 urlacl /u http://+:80/MsDeployAgentService/
    

    这应该响应:HttpDeleteServiceConfiguration Completed with 0.

    httpcfg set urlacl /u http://+:8172/MsDeployAgentService/ /a D:(A;;GX;;;NS)
    

    这应该响应:HttpSetServiceConfiguration Completed with 0.

    /a 开关中指定的 ACL 应与 httpcfg query urlacl 命令报告的 ACL 匹配

  5. 重新启动 msdepsvc (net start msdepsvc)。

  6. 您可以通过执行以下操作来确认该服务正在侦听端口 8172:

    <前><代码>netstat -an

    您应该看到以下内容:

    TCP 0.0.0.0:8172 0.0.0.0:0 监听
    

警告:

我会首先在非生产计算机上尝试此操作,以确保这正如你所期望的那样工作。

There's a couple of ways to do this:

Option 1: Uninstall and re-install Specifying a different port:

msiexec /I WebDeploy_x86_en-US.msi /passive ADDLOCAL=ALL LISTENURL=http://+:8172/MsDeployAgentService

The command line installs the MsDeployAgentService and configures it to listen on port 8172 just like on IIS7.

Option 2: Re-configure Existing Service to listen on port 8172:

  1. Stop the msdepsvc (net stop msdepsvc)

  2. Edit the following registry value:

    HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters\ListenUrl
    

    It'll look something like:

    http://+:80/MsDeployAgentService
    

    Change to:

    http://+:8172/MsDeployAgentService
    
  3. Query HTTP listeners:

    httpcfg query urlacl
    

    Your should see the following entry listed in the results:

    URL : http://+:80/MsDeployAgentService/
    ACL : D:(A;;GX;;;NS)
    
  4. Modify listener:

    httpcfg delete urlacl /u http://+:80/MsDeployAgentService/
    

    This should respond with: HttpDeleteServiceConfiguration completed with 0.

    httpcfg set urlacl /u http://+:8172/MsDeployAgentService/ /a D:(A;;GX;;;NS)
    

    This should respond with: HttpSetServiceConfiguration completed with 0.

    The ACL specified in the /a switch should match the ACL reported by the httpcfg query urlacl command

  5. Restart the msdepsvc (net start msdepsvc).

  6. You can confirm that the service is listening on port 8172 by doing:

    netstat -an
    

    You should see the following:

    TCP    0.0.0.0:8172           0.0.0.0:0              LISTENING
    

Warning:

I would try this on a non-production machine first to ensure this works as you expect.

烏雲後面有陽光 2024-11-11 09:09:16

这些是我必须按照 Kev 的秘诀对 Windows 7 进行的更改:

步骤 3:
netsh http show urlacl

第 4 步:
netsh http 删除 url=http://+:80/MSDEPLOYAGENTSERVICE/

netsh http 添加 url=http://+:8172/MSDEPLOYAGENTSERVICE/ sddl=D:(A;; GX;;;NS)

These are the changes I had to do for Windows 7, following Kev's recipe:

Step 3:
netsh http show urlacl

Step 4:
netsh http delete urlacl url=http://+:80/MSDEPLOYAGENTSERVICE/

netsh http add urlacl url=http://+:8172/MSDEPLOYAGENTSERVICE/ sddl=D:(A;;GX;;;NS)

薄暮涼年 2024-11-11 09:09:16

不管怎样,我将 Kev 的可靠建议整合到一个批处理脚本中,以便一站式更改端口号。

:: Name:     MsDepSvc.Port.cmd
:: Purpose:  Modifies the TCP/IP port that the Web Deployment Agent Service
::           (MsDepSvc) listens on.  Tested on Win7 Enterprise 32-bit.
:: Author:   [email protected]
:: Revision: January 2013

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:: variables
SET me=%~n0
SET url=
SET port=
IF NOT "%~1"=="" (
  SET /A port=%~1
)

ECHO %me%: Web Deployment Agent Service (MsDepSvc) port change script

:: default argument values
IF "%port%"=="" (
  SET /A port=8172
  ECHO %me%: INFO - using default port value of 8172
)

SC.EXE query msdepsvc >NUL 2>NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - MsDepSvc not installed
  ECHO %me%: exiting
  EXIT /B 1
)

ECHO %me%: stopping MsDepSvc
NET STOP msdepsvc >NUL 2>NUL

:: check if the default port is set
REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl >NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - MsDepSvc ListenUrl registry key not found
  REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters
  ECHO %me%: exiting
  EXIT /B 2
)

FOR /F "tokens=3" %%I IN ('REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl ^| FINDSTR ListenUrl') DO (
  SET url=%%I
)
ECHO %me%: INFO - MsDepSvc current reservation is "%url%"

NETSH.EXE http show urlacl "%url%" >NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - reservation for "%url%" not found
  EXIT /B 4
)

:: save the existing urlacl properties for User, Listen, Delegate, and SDDL
FOR /F "tokens=1,* delims=: " %%A IN ('NETSH.exe http show urlacl %url%  ^| FINDSTR "User Listen Delegate SDDL"') DO (
  SET URLACL.%%A=%%B
)

IF NOT DEFINED URLACL.User     ECHO %me%: Failed to read the exising URLACL setting for User     &&GOTO :ERROR
IF NOT DEFINED URLACL.Listen   ECHO %me%: Failed to read the exising URLACL setting for Listen   &&GOTO :ERROR
IF NOT DEFINED URLACL.Delegate ECHO %me%: Failed to read the exising URLACL setting for Delegate &&GOTO :ERROR
IF NOT DEFINED URLACL.SDDL     ECHO %me%: Failed to read the exising URLACL setting for SDDL     &&GOTO :ERROR

ECHO %me%: updating MsDepSvc to listen on port %port%
REG.EXE ADD HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl /t REG_SZ /f /d "http://+:%port%/MSDEPLOYAGENTSERVICE/"

ECHO %me%: deleting the existing reservation for MsDepSvc
NETSH.EXE http delete urlacl "%url%" || GOTO :ERROR

ECHO %me%: adding the port %port% reservation for MsDepSvc
NETSH.EXE http add urlacl url=http://+:%port%/MsDeployAgentService/ user="%URLACL.User%" listen="%URLACL.Listen%" delegate="%URLACL.Delegate%" SDDL="%URLACL.SDDL%"  || GOTO :ERROR

ECHO %me%: starting MsDepSvc
NET START msdepsvc >NUL 2>NUL

ECHO %me%: process info for MsDepSvc
QUERY.EXE PROCESS MSDEPSVC.EXE
ECHO.
ECHO %me%: port bindings for MsDepSvc
NETSTAT.EXE -a -n -o | FINDSTR /R "TCP.*:%port%.*LISTENING Proto"
ECHO.
ECHO %me%: finished

:END
ENDLOCAL
ECHO ON
@EXIT /B 0

:ERROR
ECHO %me%: ERROR - exiting with errorlevel %ERRORLEVEL%
ECHO ON
@EXIT/B %ERRORLEVEL%

了解更多:

  • https://gist.github.com/steve-jansen/5060329
  • <一个href="http://steve-jansen.github.com/blog/2013/02/28/how-to-modify-the-tcp-slash-ip-port-binding-for-the-microsoft-web-deployment -代理服务/” rel =“noreferrer”> http://steve-jansen.github.com/blog/2013/02/28/how-to-modify-the-tcp-slash-ip-port-binding-for-the-microsoft-网络部署代理服务/

For what it's worth, I glued together Kev's solid advice into a batch script for one stop shopping on changing port numbers.

:: Name:     MsDepSvc.Port.cmd
:: Purpose:  Modifies the TCP/IP port that the Web Deployment Agent Service
::           (MsDepSvc) listens on.  Tested on Win7 Enterprise 32-bit.
:: Author:   [email protected]
:: Revision: January 2013

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:: variables
SET me=%~n0
SET url=
SET port=
IF NOT "%~1"=="" (
  SET /A port=%~1
)

ECHO %me%: Web Deployment Agent Service (MsDepSvc) port change script

:: default argument values
IF "%port%"=="" (
  SET /A port=8172
  ECHO %me%: INFO - using default port value of 8172
)

SC.EXE query msdepsvc >NUL 2>NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - MsDepSvc not installed
  ECHO %me%: exiting
  EXIT /B 1
)

ECHO %me%: stopping MsDepSvc
NET STOP msdepsvc >NUL 2>NUL

:: check if the default port is set
REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl >NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - MsDepSvc ListenUrl registry key not found
  REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters
  ECHO %me%: exiting
  EXIT /B 2
)

FOR /F "tokens=3" %%I IN ('REG.EXE QUERY HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl ^| FINDSTR ListenUrl') DO (
  SET url=%%I
)
ECHO %me%: INFO - MsDepSvc current reservation is "%url%"

NETSH.EXE http show urlacl "%url%" >NUL
IF NOT "%ERRORLEVEL%"=="0" (
  ECHO %me%: ERROR - reservation for "%url%" not found
  EXIT /B 4
)

:: save the existing urlacl properties for User, Listen, Delegate, and SDDL
FOR /F "tokens=1,* delims=: " %%A IN ('NETSH.exe http show urlacl %url%  ^| FINDSTR "User Listen Delegate SDDL"') DO (
  SET URLACL.%%A=%%B
)

IF NOT DEFINED URLACL.User     ECHO %me%: Failed to read the exising URLACL setting for User     &&GOTO :ERROR
IF NOT DEFINED URLACL.Listen   ECHO %me%: Failed to read the exising URLACL setting for Listen   &&GOTO :ERROR
IF NOT DEFINED URLACL.Delegate ECHO %me%: Failed to read the exising URLACL setting for Delegate &&GOTO :ERROR
IF NOT DEFINED URLACL.SDDL     ECHO %me%: Failed to read the exising URLACL setting for SDDL     &&GOTO :ERROR

ECHO %me%: updating MsDepSvc to listen on port %port%
REG.EXE ADD HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters /v ListenUrl /t REG_SZ /f /d "http://+:%port%/MSDEPLOYAGENTSERVICE/"

ECHO %me%: deleting the existing reservation for MsDepSvc
NETSH.EXE http delete urlacl "%url%" || GOTO :ERROR

ECHO %me%: adding the port %port% reservation for MsDepSvc
NETSH.EXE http add urlacl url=http://+:%port%/MsDeployAgentService/ user="%URLACL.User%" listen="%URLACL.Listen%" delegate="%URLACL.Delegate%" SDDL="%URLACL.SDDL%"  || GOTO :ERROR

ECHO %me%: starting MsDepSvc
NET START msdepsvc >NUL 2>NUL

ECHO %me%: process info for MsDepSvc
QUERY.EXE PROCESS MSDEPSVC.EXE
ECHO.
ECHO %me%: port bindings for MsDepSvc
NETSTAT.EXE -a -n -o | FINDSTR /R "TCP.*:%port%.*LISTENING Proto"
ECHO.
ECHO %me%: finished

:END
ENDLOCAL
ECHO ON
@EXIT /B 0

:ERROR
ECHO %me%: ERROR - exiting with errorlevel %ERRORLEVEL%
ECHO ON
@EXIT/B %ERRORLEVEL%

Read More:

指尖上的星空 2024-11-11 09:09:16

还值得了解找出哪些属性存储在哪个注册表项中的魔力 - 输入 Orca.exe - 用于读取/修改 MSI 数据库的宝贵且易于使用的工具(但尽量不要修改) 。

首先我们需要在Property表中找到该属性
输入图片此处描述

找到属性后,转到注册表并查找其插入位置。
输入图片此处描述

It is also worth knowing the magic behind finding out what property is stored in which registry key - enter Orca.exe - invaluable and simple to use tool for reading/modifying MSI database (try not to modify though).

First, we need to find the property in the Property table
enter image description here

Once the property is found, go to the Registry table and find where it is inserted.
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文