Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC deployment in a form of distribution package

I have an ASP.NET MVC application. And I need a way to deploy it.

BUT

I don't need to just copy it to my own web server. It's not meant to be a website that it available on the Internet. No.

Instead, I need my users to be able to install it on their own server. Which may or may not be visible from the Internet.

That is, I need to create an MSI package (or EXE self-extracting installer, or whatever) that my customer can just double-click on, and the MVC app should get installed on their local IIS.

I can, of course, just plain write some code that would extract the files, copy them to the local hard drive, and then create a website or a virtual directory in IIS, blah-blah-blah. But something tells me there should be an easier way. Like, say, a WiX extension that already does that. Or something.

Note: the application is very simple. No need for databases, special privileges, SMTP server configuration... Or, in fact, any kind of configuration at all. Just copy the files and create IIS app.

like image 565
Fyodor Soikin Avatar asked Apr 26 '11 12:04

Fyodor Soikin


People also ask

What is App_Start in asp net?

The App_Start folder of MVC application is used to contain the class files which are needed to be executed at the time the application starts. The classes like BundleConfig, FilterConfig, IdentityConfig, RouteConfig, and Startup. Auth etc. are stored within this folder.


2 Answers

This might need some coding but (if you need a pretty presentable UI) there is a feature in Visual Studio build deployment package.

Build delpoyment package

Where it will build you a package that your customer can run to create all the necessary things in IIS, so IIS settings are applied as well. Scott Hanselman has a series of posts about it. You can change the default settings from package/publish settings.

package/publish settings. To deploy the packages you must have msdeploy.exe. You could send the zipped folder and when your customers run the .cmd file they will be up and running in no time. However if you want to put pretty bows around the package you can run it from a C# application ther will be some coding required but I'm sure that wont take more than 15 minutes.

Usage:
--------------------------
{0} [/T|/Y] [/M:ComputerName] [/U:UserName] [/P:Password] [/G:UseTempAgent] [Additional msdeploy.exe flags ...]

All you basically have to do is

System.Diagnostics.Process proc = new System.Diagnostics.Process();
const string filename = @"/*some file location*/";
proc.StartInfo.FileName = filename;
proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
like image 174
Sevki Avatar answered Sep 27 '22 16:09

Sevki


Whenever I run into the need for a complex install I always turn to WiX.

You can use WiX to install your MVC based website and then use the IIS Extension (http://wix.sourceforge.net/manual-wix3/iis_xsd_index.htm) to create a new app pool and site for it to run under.

A few issues I can think of that you might want to look into deeper would be:

  • What if the user doesn't have IIS installed?
  • What if they do not have the MVC Tools package installed (aka to bundle or not to bundle)?

Other than those points I think WiX + the IISExtension will easilly cover your basic, copy files and create website requirement.

like image 44
BGregorius Avatar answered Sep 27 '22 16:09

BGregorius