我在Windows 2003机器上遇到了一些挑战,我需要在不是80的端口上运行Web部署代理。默认情况下,MsDepSvc将在http:// [服务器]上公开端点/ MsDeployAgentService显然隐式侦听端口80。
我遇到的问题是该机器还在运行使用端口80的Visual SVN Server,因此Web部署代理服务拒绝启动。 (至少这是我能得出的唯一合乎逻辑的结论。)我在同一台机器上有一个小型SVN管理应用程序,我想通过Web部署发布这个难题。
是否可以在另一个端口上运行代理?显然,如果这是IIS7,我们将在8172上,一切都会好的,但不幸的是,情况并非如此。有什么建议吗?
答案 0 :(得分:62)
有几种方法可以做到这一点:
选项1:卸载并重新安装指定其他端口:
msiexec /I WebDeploy_x86_en-US.msi /passive ADDLOCAL=ALL LISTENURL=http://+:8172/MsDeployAgentService
命令行安装MsDeployAgentService并将其配置为侦听端口8172,就像在IIS7上一样。
选项2:重新配置现有服务以侦听端口8172:
停止msdepsvc(net stop msdepsvc
)
编辑以下注册表值:
HKLM\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters\ListenUrl
它看起来像是:
http://+:80/MsDeployAgentService
更改为:
http://+:8172/MsDeployAgentService
查询HTTP侦听器:
httpcfg query urlacl
您应该会看到结果中列出的以下条目:
URL : http://+:80/MsDeployAgentService/
ACL : D:(A;;GX;;;NS)
修改监听器:
httpcfg delete 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匹配
重新启动msdepsvc(net start msdepsvc
)。
您可以通过执行以下操作确认服务正在侦听端口8172:
netstat -an
您应该看到以下内容:
TCP 0.0.0.0:8172 0.0.0.0:0 LISTENING
警告:强>
我会首先在非生产机器上尝试这个,以确保它按预期工作。
答案 1 :(得分:26)
这些是我按照Kev的方法对Windows 7所做的更改:
第3步:
netsh http show urlacl
第4步:
netsh http delete urlacl url=http://+:80/MSDEPLOYAGENTSERVICE/
netsh http add urlacl url=http://+:8172/MSDEPLOYAGENTSERVICE/ sddl=D:(A;;GX;;;NS)
答案 2 :(得分:7)
对于它的价值,我将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: stevejansen_github@icloud.com
:: 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%
阅读更多:
答案 3 :(得分:0)
同样值得了解查找哪个属性存储在哪个注册表项中的魔力 - 输入Orca.exe - 无价且易于使用的工具,用于读取/修改MSI数据库(尽管不要修改)。 / p>