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.