Deployment of ASP.NET MVC 4 web application with Entity Framework Code First approach - entity-framework

I want to make incremental releases of a web application implemented in ASP.NET using MVC 4 and Entity Framework Code-First.
I want to make a good and safe deployment routine. I currently use Subversion as source control, and plan to make releasable tags available on the SVN server, to deploy on the production server. The server runs on a separate network, but has access to the SVN server.
The server runs both IIS and MSSQL server.
What is the best way to deploy new releases to the production server using SVN? Prebuilt binaries or build on site.
How to handle model changes on the production server? On development I use Update-Database function on the Package Manager Consol in Visual Studio.
EDIT:
I will try to base my setup on this blog post, which uses git instead of SVN: http://www.jayway.com/2012/10/17/a-simple-continuous-integration-and-deployment-workflow-with-asp-net-mvc-github-and-jenkins/
But still all suggestions are very welcome.

Related

How can I achieve this website project deployment strategy?

I have a small team working on web site project using Visual Studio 2010 and with Team Foundation server 2012.
In order to have proper control on deployment, I would like to implement my dream deployment strategy as shown in the figure ( https://www.dropbox.com/sc/foy5fh7pntreiha/AAB4L4hhbpjcm1zHi6VBLSa6a )
There is no problem for my team to perform the check in/out between their development pc with the TFS server. But I have problem to deploy code from TFS server to targeted web server.
I read many articles talking about build deploy, but for me I don't think I need to do build because mine is not a web application and we basically have all the codes in the targeted web server. We don't need to build the project into dll and then only upload to web server.
I tried using "copy website" feature in Visual Studio 2010, but on the copy website panel, it is always local programmer pc code at the left hand side and the targeted web server on the right hand side.
I wanted this deployment flow because I think this is the safest flow so that no one will accidentally upload the wrong version of code into the web server. Everyone would have no choice but to check in their code(s) into the TFS server before he/she can upload into the web server.
Please kindly help me.
Thanks
Dont do that.
Instead use Stage / Production server, Stage and Master git branches,
Tell them to exclusively work out of stage, you control the merge to master,
use deployhq or similar service to hook into git(github) and trigger automatic deployments.
Much better than VS, much safer. Should a deploy not work due to file error, DHQ will prevent the entire deployment and revert to old state.

How to upload pure HTML site with TFS build

Our web site solution consists of frontend folder, where pure html/css/js application resides, and an ASP.NET WebAPI backend. I am setting up a TFS build for dev and qa environment.
Currently, I have made WebAPI backend to publish automatically via WebDeploy. Html/js fronend also has a site setup on a target IIS machine where I am trying to deploy to. But WebDeploy only works with ASP.NET sites. What mechanism I could utilize to copy files of fronend to target folder on IIS machine?
This might help:
http://www.incyclesoftware.com/2014/06/deploying-uncompiled-resources-release-management/
I haven't had a chance to test it myself yet.

Deploy MVC 4 application 4.5 Framework 1and1 hosting

I'm trying to deploy an mvc 4 project in vs2012 via FTP on 1and1.com
This is what I'm getting.
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Are there settings on 1and1 I need to set somewhere because it's an MVC proj or changes in webconfig?
#dright, Are you still encountering the problem? It appears 1and1.com has updated their hosting package to support 4/4.5 Framework with their Basic Windows hosting plans (https://www.1and1.com/windows-hosting?linkId=hd.subnav.windowshosting). I purchased a plan as a sandbox for deploying little apps that I develop.
I have successfully deployed a Asp.Net application using the WebMatrix IDE. But I have struggled using VS2013 template/default applications' Web.Config. I was curious if you have had any luck.
Thanks!
1and1 windows package doesn't support MVC. You would need to update to their server package. ~59/month

how can I set up a continuous deployment with TFSBuild for MVC app?

I have some questions around the best mechanism to deploy MVC web applications to different environments. Previously I used setup projects (.msi's) but as these have been discontinued in VS2012 I am looking to move to an alternative.
Let me explain my current setup. I currently have a CI setup using TFSBuild 2010 with Team Foundation Server for source control.
A number of developers work on their local machines and check in to the TFS Server. We regularly deploy to a single server dev environment and a load balanced qa environment with 2 servers. Our current process includes installing an msi which carries out some of the following custom actions:
brings current app offline with the app_offline.htm file
run in database scripts (from database project in the solution)
modifies web.config (different for each web server of qa)
labels the code
warmup each deployed file via http request
etc
This is the current process. Now I would like to make some changes. Firstly, I need alternative to msi's. From som research I believe that web deploy via IIS and using MsDeploy is the best alternative. I can use web config transforms for web config modifications. Is this correct and if so, could I get an outline of what I need to do?
Secondly I want to set up continuous delivery via TFSBuild, I have no idea how this may be achieved, would it be possible to get an outline of how it can be integrated in to my current setup? Rather than check in driven, I would like it to be user driven following check in. Also, would it be possible for this to also run in database scripts from a database project in the solution.
Finally, there is also a production environment, but I would like to manually deploy this - can my process also produce an artifact that I can manually install?
Vishal Joshi has some information on his blog that is reasonably good, http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html. It does have the downside that your deployment password is include in the properties you pass to msbuild.
Syed Hashimi has also posted some information on this in another questions Team Build: Publish locally using MSDeploy.

Deploy Entity Framework Code First

I guess I should have thought of this before I started my project but I have successfully built and tested a mini application using the code-first approach and I am ready to deploy it to a production web server.
I have moved the folder to my staging server and everything works well. I am just curious if there is a suggested deployment strategy?
If I make a change to the application I don't want to lose all the data if the application is restarted.
Should I just generate the DB scripts from the code-first project and then move it to my server that way?
Any tips and guide links would be useful.
Thanks.
Actually database initializer is only for development. Deploying such code to production is the best way to get some troubles. Code-first currently doesn't have any approach for database evolution so you must manually build change scripts to your database after new version. The easiest approach is using Database tools in VS Studio 2010 Premium and Ultimate. If you will have a database with the old schema and a database with the new schema and VS will prepare change script for you.
Here are the steps I follow.
Comment out any Initialization strategy I'm using.
Generate the database scripts for schema + data for all the tables EXCEPT the EdmMetadata table and run them on the web server. (Of course, if it's a production server, BE CAREFUL about this step. In my case, during development, the data in production and development are identical.)
Commit my solution to subversion which then triggers TeamCity to build, test, and deploy to the web server (of course, you will have your own method for this step, but somehow deploy the website to the web server).
You're all done!
The Initializer and the EdmMetadata tables are needed for development only.