使用Web Deploy将MVC应用发布至Windows Server IIS时遇连接错误
解决Visual Studio发布MVC应用到IIS时无法连接服务器的问题
错误信息:
Severity Code Description Project File Line Suppression State Error Web deployment task failed. (Could not connect to the remote computer ("servername"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.) WebPortal 0
排查解决步骤:
- 检查远程服务器是否安装Web Deploy:
打开服务器的「程序和功能」,确认存在“Microsoft Web Deploy”相关组件,缺失则重新安装适配服务器系统版本的Web Deploy。 - 确保**Web Management Service(WMSVC)**处于运行状态:
服务器端打开「服务」管理器,找到“Web Management Service”,确认状态为「正在运行」;若未启动,右键启动并将启动类型设为「自动」。 - 配置服务器防火墙规则:
添加入站规则,允许TCP端口8172(Web Deploy默认端口)的流量通过,避免端口被防火墙拦截。 - 核对VS发布配置的服务器地址:
替换发布配置中的服务器别名,直接使用服务器的内网/公网IP地址,排除DNS解析问题。 - 检查IIS管理服务设置:
服务器端打开IIS管理器,选中服务器节点,点击「管理服务」,确认已勾选「启用远程连接」,并核对监听端口与VS发布配置一致。 - 验证发布账号权限:
确保发布使用的服务器账号属于「IIS管理器用户」组,或拥有目标网站的发布权限。
内容的提问来源于stack exchange,提问作者cookiemonster
相关产品推荐
相关产品推荐

