重新编译asp.net网站时如何重新启动IIS网站 [英] How to restart the IIS Site when re-compiling an asp.net website

查看:235
本文介绍了重新编译asp.net网站时如何重新启动IIS网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

添加到Asp.net项目的生成/编译脚本中以启动IIS以重新启动DLL重建网站而不是对站点的第一个请求的最佳方法是什么。

What is the best way to add into the build/compile script of an Asp.net project to initiate a IIS to restart the website on DLL rebuild instead of the first request to the site.

当前过程


  1. 编译项​​目

  2. 等待

  3. 命中APSX页面

  4. IIS开始重新加载

  5. 等待

  6. 页面加载

  1. Compile Project
  2. Wait
  3. Hit APSX Page
  4. IIS starts reload
  5. Wait
  6. Page loads

理想的过程:


  1. 编译项​​目&重新加载IIS

  2. 等待

  3. 命中APSX页面

  4. 页面加载

  1. Compile Project & Reload IIS
  2. Wait
  3. Hit APSX Page
  4. Page loads

我的第一种方法是添加一个请求,以仅点击构建后事件中的一个页面。只是想知道最佳做法。这类似于开始,它会在构建时立即打开一个页面。

The first way I though of was add a request to just hit one of the pages in the "Post-Build events". Just wondering best practices. This would be similar to "Start" which opens a page immediately on build.

更新:
我之所以要这样做是为了提高效率。 。我将把编译时间和重新启动时间封装为一批,以节省下面第4步的时间。

Update: The reason I would like to accomplish this is for just for efficiency. I would the to encapsulate the compile time and the restart time into one batch to save on time on step 4 below


  1. VS: ctrl + shift + b

  2. 等待视觉查询构建成功。

  3. 浏览器: F5

  4. 等待IIS重新加载。 (以及 SO中未回答的问题中的Hit kbd> F5)

  5. 测试页
  6. >
  1. VS: ctrl+shift+b
  2. Wait for visual que "Build succeeded".
  3. Broswer: F5.
  4. Wait for IIS reload. (as well as Hit kbd>F5 in unanswered questions in SO)
  5. Test page


推荐答案

一种简单的方法是编写shell vb脚本或PowerShell脚本以使用XmlHttpRequest来请求

A naive way would be to write a shell vb script or PowerShell script to use XmlHttpRequest to request a page from the site, and include that as a post-build task.

您是否有任何特定原因需要这样做?如果您在第一次JIT时遇到性能问题,则可能需要考虑将应用程序分解为较小的项目/ DLL(假定存在问题),或者开始查看应用程序启动时出现的瓶颈。

Is there any particular reason you feel the need to do this? If you're experiencing performance issues at the first JIT then you may need to consider breaking up your application into smaller projects/DLLs (assuming that size is the issue), or start looking at bottlenecks that occur when your app starts.

另一个问题:为什么要重置IIS?在第一个页面请求之前,不会重新编译DLL。与传统的ASP不同,无需重新启动IIS即可使DLL更改生效/生效。

Another question: why the IIS reset? That won't cause the DLL to be recompiled until the first page request. Unlike classic ASP, it isn't necessary to restart IIS for DLL changes to be allowed/take effect.

这篇关于重新编译asp.net网站时如何重新启动IIS网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆