The best way to deploy a website is to stop the application pool or stop the website

What is the best way to deploy changes to a website (replace DLLs and other necessary files)?

Should a website need to be stopped and started or should the application pool be stopped and started?

I read that when the site is stopped, it still has the application state loaded into memory. In this case, will the old request be submitted? Is it possible to replace dll without any problems? How does the content load when the website starts?

When the application pool is stopped, will it continue to serve old requests? If so, how does the old request handle the website, now contains the modified dlls?

+5
source share
2 answers

What is the best way to deploy changes to a website (replace DLLs and other necessary files)?

It is best to use Web Deploy to automate the process. It automatically compares files and replaces only what is needed and deletes what is not needed, making it very fast, efficient and reliable.

Should a website need to be stopped and started or should the application pool be stopped and started?

You, as a rule, do not need it either. However, if you want to prevent access to your site during the upgrade, and it is expected that the upgrade will take longer than a few seconds, you can stop the website and start another that uses the same IIS bindings as the "Application under technical service "".

I read that when the site is stopped, it still has the application state loaded into memory. In this case, will the old request be submitted? Is it possible to replace dll without any problems? How does the content load when the website starts?

The HTTP protocol has no status. Thus, most updated materials will be reloaded from new files on the server.

There are a few exceptions.

If you use session state outside the process , the state will be preserved even if the application is recompiled and reloaded. Typically, the data that you have in session state is what you want to survive the upgrade.

If you use caching ( System.Web.Caching or System.Runtime.Caching ), the cached data will remain if you specify to make it "Not removable." As a rule, I use one file for the application as a cache dependency, so when this file is edited (or replaced) on the server, the cache will be reset.

Output caching has no cache dependencies. It is usually saved until the application pool is restarted. But you can see this answer for the manual reset method without reset application pool.

Cookies are stored on the computers of remote clients. Therefore, they will survive unchanged.

Static files (images, css and javascript files) are usually cached on remote client computers. Therefore, when you upgrade, it is useful to add a query string at the end of these URLs to ensure that the cached file will not be used. See this article for one such approach.

When the application pool is stopped, will it continue to serve old requests? If so, how does the old request handle the website, now contains the modified dlls?

As I mentioned, the HTTP protocol has no status. The server will not play any previous requests made by clients. After the client receives a response, the server essentially forgets about them.

Many of the ways the web server handles the update are determined by whether it is a web application or a website (and if the website has been precompiled). If the application is running during the update, users trying to access it may see errors.

My advice: don't worry about it. Schedule updates after hours. Use Web Deploy to automate the process to make the update window as short as possible. And use the above methods to ensure that the cached data and the contents of the reset are safe. In most applications, a few seconds or minutes of downtime in the middle of the night are almost invisible.

+4
source

At first, I don't like the web deployment that is required for many things installed and managed on your servers. it is also harder than necessary. (my opinion) I read your comments:

for what you want to do, the following parameters are needed: archecture: you need to start 2 stacks of the site server with some kind of load balancer. (web interface and middleware or whatever you do)

take one stack from the firewall, leave the application live on the other side, check your logs to ensure that transactions are completed on the site on which you are deploying.

deploy:

Stop the website / service (AppPool) REMOVE all existing files associated with this web service / website, to delete use xCopy to install all the files (or extracting the zip to the target will also work) start the website / service (AppPool) test from the internal network to verify that it is running deployment completed.

disable access to another site and activate the site (or styles) that you completed (on the firewall balancer. this will allow you to complete existing transactions and make your new code live.

more elements should be specified in your deployment, but this should help you get started. greetings and good luck!

0
source

Source: https://habr.com/ru/post/1215414/


All Articles