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.
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.
This might need some coding but (if you need a pretty presentable UI) there is a feature in Visual Studio build deployment 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.
. 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();
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:
Other than those points I think WiX + the IISExtension will easilly cover your basic, copy files and create website requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With