Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update ASP.Net site dll without stopping site

Is it possible to update the site dll for a precompiled site without stopping IIS.

Currently, if I try to just copy the new file to overwrite the current file, All users receive runtime errors while the file is being copied. Is there a way to avoid this?

like image 968
muel98 Avatar asked Oct 21 '09 17:10

muel98


1 Answers

even if you don't stop, any change to the web.config file, BIN folder, App_Data or App_Code will force the .NET compiler to perform ...

and you will loose any Session variables in memory.

What I do is to use Session State in SQL Mode and if your system is set up like this, user will remain in the site (after a longer exposition to a page reload)

.NET will still invoke the compiler in order to compile the new set of instructions but soon it is done, all sessions will be read from SQL Server and because they are still there (and not lost with a memory refresh) users will remain in the website with current credentials.

it is a little bit slower than In-Memory Session State, but much more reliable, specially with Shared hosting :) this is the way to increse/decrese the minutes in your session, as Shared hosting do not allow it to change even if you do

Session.Timeout = 5;

their machine configuration will override everything you do, with SQL Session State, you will be able to set your time as this is all made by SQL Server.

Fell free to read this article to know how everything is done.

Hope it helps.

like image 197
balexandre Avatar answered Sep 19 '22 18:09

balexandre