[asp.net 5][asp.net core]不用停掉iis站台也能更新站台應用程式的方式

  • 515
  • 0

[asp.net 5][.net core]不用停掉iis站台也能更新站台應用程式的方式

在要更新的iis應用程式的實體路徑丟一個檔案app_offline.htm,然後應用程式就會進入離線模式,此時該應用程式的檔案就不會被咬住(例如:oooxx.exe, ooxx.dll),接著就可以把新的發行檔蓋過去了,發行完之後再把這個.html刪掉即可(不然網站會一直維持在離線模式),以下是app_offline.htm的範本,在網路上找到的,提供做為參考:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Offline</title>
</head>
<body style="margin:3em;font-family:sans-serif">
  <h2>Offline</h2>
  <p>This site is offline for maintenance.</p>
  <!--       
    Adding some hidden content so that IE "Friendly Errors" don't keep
    this message from displaying. (It will show a "friendly" 404
    error if the content isn't at least 512 bytes.)
    This is mostly a problem for IE6 which has "Friendly Errors" on by default.
    See http://weblogs.asp.net/scottgu/App_5F00_Offline.htm-and-working-around-the-_2200_IE-Friendly-Errors_2200_-feature
    
    <h2>This site is offline.</h2>
    <h2>This site is offline.</h2>
    <h2>This site is offline.</h2>
    <h2>This site is offline.</h2>
    <h2>This site is offline.</h2>
    -->
</body>
</html>

參考資料:
https://stackoverflow.com/questions/40277924/how-to-publish-asp-net-core-app-dlls-without-having-to-stop-the-application
https://gist.github.com/robert-claypool/5179576de025b4814744