webdeploy环境搭建

. 服务器配置

  •  为了使用web deploy进行发布,你首先要安装web deploy工具,
  •  可以从WebPlatform Installer中选择最新的版本进行安装,需要注意的是,安装web deploy时最好全部安装,不然会出现一些奇奇怪怪的问题
  •  如果你还没有webPlatform Installer,你可以去MSDN https://www.microsoft.com/web/downloads/platform.aspx 下载
  •  安装号web delopy后点击你的IIS服务器,https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714154803255-67793477.png,你应该能看到

https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714154911483-2021832510.png

 

  •   其中的管理服务,如果没有看到,请尝试重新安装web deploy工具
  •  双击管理服务器,
  • https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714155031335-604412845.png

 

  •  请留意这里的端口号,以及IP地址限制这两栏,
    • 若你未使用默认端口,在配置Visual studio中的发布配置文件时就需要为你的服务器指定端口,
    • 若这里的IP地址限制中,未指定的客户端的访问全为禁止,那么你需要指定你的发布客户端所在IP被允许访问
    • 若以上两点未做到,在发布时会出现 could not connect to the remote computer('IP') using the specified process (" Web Management Service ") xxx
  •  有了以上步骤后,你的Visual studio在发布时就能 成功 connect了,但是依然可能发布失败
  •  IIS中,选中你将要发布的网站 
  • https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714155743455-1732149348.png

 

  •  进入 IIS管理器权限,点击右边的允许用户,https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714155808858-2128068998.png,选择下面的IIS管理器,添加你的IIS用户,

 

  •  在你的网站上右键,点击编辑权限->安全->编辑->添加,添加Users用户权限为完全控制,添加IIS_IUSRS为完全控制(ps:第一个是为了让你有权限发布文件到站点目录,第二个是为了预防以后出现权限不对的问题,具体的我忘了)
  •  到这里,基本配置就完成了
  •  如果你的服务器开启了防火墙的话,还需要注意将 Web Management之类的进程设置为允许通过(具体名称忘了,我这里没有出现那个进程);

. Visual studio 中的publish配置

  •  在要发布的项目上右键,点击publish,如果之前没有创建publish的配置文件,那么这里需要创建一个配置文件
  • 选择IISFPTetc选项,创建一个配置文件,在publish method中选择web deploy
  • https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714153359410-1327152134.png
  •  server中填入你想要发布到的服务器的IPsite name是你要发布的站点的name,这个name使用IIS中创建的网站的name,账号名和密码是你登陆部署服务器的账号密码,最后一个URL是你发布之后用于访问该网站的链接
  •  填完之后,先点击https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714153632074-813937432.png进行链接测试,一般来说只要你的IIS服务器配置完整,基本直接就是绿勾,如果出现了黄色叹号,莫急,后面给出我的解决方案;
  •  点击下一步,然后就是配置一些选项,这些依据各自项目的需要进行配置。
  • 最后点击publish即可,需要注意的是,如果你从文件资源管理器删除了你项目中的文件,但是没有从Visual studio中删除,那么publish的时候是会报错的,只需要从Visual studio中删除对应文件即可

, 常见报错解决

  •  如果你有时间的话呢,可以详细看看 https://docs.microsoft.com/en-us/iis/publish/troubleshooting-web-deploy/troubleshooting-web-deploy-problems-with-visual-studio 官方给出的一些问题解决方案
  1. could not connect to the remote computer("xxxxx") using the specified process (" Web Management Service ") because the server did not respond Make sure that the process (" Web Management Service ") is started on the remote computer xxxxx

https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714161403463-1326432255.png

 

    •  这个报错就是说你连不上远程部署服务器,首先检查网络连接以及账号密码什么的
    • 检查你远程服务器的 Windows Deployment Services Server 服务正常运行,或者对其进行重启
    • 如果你没有这个服务,或者启动不了,尝试回到 服务器配置 章节重新安装web deploy
    • 检查服务器配置章节中提到的IP过滤规则,以及端口号,权限问题,
    • 如果依然报相同的错误,请尝试Google
  1. connected to the remote computer ("XXX") using the Web Management Service,but could not authorize,Make suere that you are using the correct user name

  and password that the site you are connecting to exists, and that the crederitals represent a user who has permissions th access the site..

  https://img2018.cnblogs.com/blog/1168541/201907/1168541-20190714161850334-1531041159.png

 

    •  这个报错主要是权限问题,请尝试回到 服务器配置的权限设置部分,正确添加用户权限

3. 

Web deployment task failed. ((2019/7/13 19:26:43) An error occurred when the request was processed on the remote computer.)

 

2019/7/13 19:24:27

System.AggregateException: One or more errors occurred. ---> System.Exception: Build failed. Check the Output window for more details.

   --- End of inner exception stack trace ---

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

   at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.<PublishAsync>b__2()

   at System.Threading.Tasks.Task`1.InnerInvoke()

   at System.Threading.Tasks.Task.Execute()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__127.MoveNext()

---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.<---

 

===================

 

  我在发布的时候遇到了一个新的报错,而且难受的是报错信息没有任何提示,经过尝试后,怀疑是权限问题,在网站上右键,编辑权限,将网站目录设置为EveryOne可访问,经过我尝试,设置Users可以完全访问即可成功发布,

当然,你要是按照我上面写的服务器配置路线走过来,应该是不会遇到这个错误的

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章