Visual Studio + web deploy deploy IIS web server to process record

A server configuration.

  •  In order to use web deploy to publish, you must first install the web deploy tools,
  •  You can choose from WebPlatform Installer to install the latest version, it should be noted that, when installed web deploy the best of all installation, otherwise there will be some strange questions
  •  If you have not webPlatform Installer, you can go to MSDN https://www.microsoft.com/web/downloads/platform.aspx download
  •  After the installation number web delopy click on your IIS server , you should see

     

  •   Which management services, if you do not, try reinstalling the web deploy tool

  •  Double-click the management server,
  •  

  •  Please note here the port number, and IP address restrictions these two columns,
    • If you do not use the default port, you need to specify the port for your server when configuring Visual studio release profile of,
    • If the IP address restriction here, the access client is not specified as a full ban, then you need to specify your client is released IP is allowed to access
    • If the above two points is not done, there will be could not connect to the remote computer ( 'IP') using the specified process ( "Web Management Service") at the time of publication xxx
  •  With these steps, your Visual studio at the time of release will be able to successfully connect, but may still failed to publish
  •  In IIS, select the site you want to publish 
  •  

  •  Into the IIS Manager Permissions , click on the right allows the user to select the following IIS Manager, add your IIS user,

     

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

二. Visual studio 中的publish配置

  •  在要发布的项目上右键,点击publish,如果之前没有创建publish的配置文件,那么这里需要创建一个配置文件
  • 选择IIS,FPT,etc选项,创建一个配置文件,在publish method中选择web deploy
  •  server中填入你想要发布到的服务器的IP,site name是你要发布的站点的name,这个name使用IIS中创建的网站的name,账号名和密码是你登陆部署服务器的账号密码,最后一个URL是你发布之后用于访问该网站的链接
  •  填完之后,先点击进行链接测试,一般来说只要你的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

 

    •  这个报错就是说你连不上远程部署服务器,首先检查网络连接以及账号密码什么的
    • 检查你远程服务器的 Windows Deployment Services Server 服务正常运行,或者对其进行重启
    • 如果你没有这个服务,或者启动不了,尝试回到 服务器配置 章节重新安装web deploy
    • 检查服务器配置章节中提到的IP过滤规则,以及端口号,权限问题,
    • 如果依然报相同的错误,请尝试Google

2.  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..

  

 

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

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可以完全访问即可成功发布,

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

 

Guess you like

Origin www.cnblogs.com/Qice/p/11184607.html