Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continuous Deployment with an ASP.NET website?

I have a website in C#/ASP.NET that is currently in development. When we are in production, I would like to do releases frequently over the course of the day, as we fix bugs and add features (like this: http://toni.org/2010/05/19/in-praise-of-continuous-deployment-the-wordpress-com-story/).

If you upload a new version of the site or even change a single file, it kicks out the users that are currently logged in and makes them start over any forms and such. Is there a secret to being able to do deployments without interfering with users for .NET sites?

like image 712
Amber Shah Avatar asked May 19 '10 19:05

Amber Shah


People also ask

Can we host asp.net website on Linux server?

ASP.NET can run on both Windows servers and Linux servers. So, don&'t feel confined to a Windows host, although Windows hosting services will be optimized for ASP.NET websites and applications. Your host will need an SQL server database, such as MySQL, to be able to host applications built using ASP.NET.

What is CI CD in .NET Core?

The . NET Core CI/CD environment manages application updates using AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy. The CI/CD pipeline polls a GitHub repository for updates.


2 Answers

If you make a change to a config file, the contents of a bin folder of the app, or things like that, the ASP.NET worker process restarts along with your application.

This results in deleted sessions and kicked-out users.

The solution is to use other session storage methods other than the default InProc.
You can achieve this by setting the session state mode. The SqlServer and StateServer options provide very good remedy for your issue.

SqlServer mode is relatively easy to set up and get up and running. (Basically, it's just creating a database, running aspnet_regsql, and then specifying it to the config.) If you don't have MS SQL Server or don't want to use it, you can use StateServer, or create your own provider and use the Custom mode.

The only restriction is that you can only store serializable values with SqlServer and StateServer mode.

like image 70
Venemo Avatar answered Oct 01 '22 20:10

Venemo


The reason you're seeing this is because you are resetting the application pool, thus resetting everyone's session.

The cleanest route would be to offload your session to a session state server, or minimize your use of session.

One way around this is if you can't offload your session is to always deploy to a new virtual directory. Your public facing URL then just redirects to your latest version. All users that are already logged in would continue to use the older version, but any new users would use the new version.

like image 20
AaronS Avatar answered Oct 01 '22 22:10

AaronS