Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you deploy your ASP.NET applications to live servers?

People also ask

Where do I deploy ASP.NET app?

In general, to deploy an ASP.NET Core app to a hosting environment: Deploy the published app to a folder on the hosting server. Set up a process manager that starts the app when requests arrive and restarts the app after it crashes or the server reboots.

How are .NET applications deployed?

You can deploy your ASP.NET web application by using the MS-DOS xcopy command-line utility. However, it's a good idea to deploy your project instead of using xcopy . As with the Copy Project command, xcopy doesn't register or verify the location of assemblies.


We have all of our code deployed in MSIs using Setup Factory. If something has to change we redeploy the entire solution. This sounds like overkill for a css file, but it absolutely keeps all environments in sync, and we know exactly what is in production (we deploy to all test and uat environments the same way).


We do rolling deployment to the live servers, so we don't use installer projects; we have something more like CI:

  • "live" build-server builds from the approved source (not the "HEAD" of the repo)
  • (after it has taken a backup ;-p)
  • robocopy publishes to a staging server ("live", but not in the F5 cluster)
  • final validation done on the staging server, often with "hosts" hacks to emulate the entire thing as closely as possible
  • robocopy /L is used automatically to distribute a list of the changes in the next "push", to alert of any goofs
  • as part of a scheduled process, the cluster is cycled, deploying to the nodes in the cluster via robocopy (while they are out of the cluster)

robocopy automatically ensures that only changes are deployed.

Re the App Pool etc; I would love this to be automated (see this question), but at the moment it is manual. I really want to change that, though.

(it probably helps that we have our own data-centre and server-farm "on-site", so we don't have to cross many hurdles)


Website

Deployer: http://www.codeproject.com/KB/install/deployer.aspx

I publish website to a local folder, zip it, then upload it over FTP. Deployer on server then extracts zip, replaces config values (in Web.Config and other files), and that's it.

Of course for first run you need to connect to the server and setup IIS WebSite, database, but after that publishing updates is piece of cake.

Database

For keeping databases in sync I use http://www.red-gate.com/products/sql-development/sql-compare/

If server is behind bunch of routers and you can't directly connect (which is requirement of SQL Compare), use https://secure.logmein.com/products/hamachi2/ to create VPN.


I deploy mostly ASP.NET apps to Linux servers and redeploy everything for even the smallest change. Here is my standard workflow:

  • I use a source code repository (like Subversion)
  • On the server, I have a bash script that does the following:
    • Checks out the latest code
    • Does a build (creates the DLLs)
    • Filters the files down to the essentials (removes code files for example)
    • Backs up the database
    • Deploys the files to the web server in a directory named with the current date
    • Updates the database if a new schema is included in the deployment
    • Makes the new installation the default one so it will be served with the next hit

Checkout is done with the command-line version of Subversion and building is done with xbuild (msbuild work-alike from the Mono project). Most of the magic is done in ReleaseIt.

On my dev server I essentially have continuous integration but on the production side I actually SSH into the server and initiate the deployment manually by running the script. My script is cleverly called 'deploy' so that is what I type at the bash prompt. I am very creative. Not.

In production, I have to type 'deploy' twice: once to check-out, build, and deploy to a dated directory and once to make that directory the default instance. Since the directories are dated, I can revert to any previous deployment simply by typing 'deploy' from within the relevant directory.

Initial deployment takes a couple of minutes and reversion to a prior version takes a few seconds.

It has been a nice solution for me and relies only on the three command-line utilities (svn, xbuild, and releaseit), the DB client, SSH, and Bash.

I really need to update the copy of ReleaseIt on CodePlex sometime:

http://releaseit.codeplex.com/