ASP.NET MVC部署分发包的形式形式、ASP、NET、MVC

2023-09-03 10:23:28 作者:把昨天打碎,让过去作废

我有一个ASP.NET MVC应用程序。我需要一种方法来部署它。

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

我不只是需要把它复制到自己的Web服务器。这并不意味着是一个网站,在互联网上使用。没有。

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.

这就是我需要创建一个MSI软件包(或EXE自解压安装,或者别的什么),我的客户可以直接双击,以及MVC应用程序应该得到他们的本地IIS安装。

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.

我可以,当然,只是简单的写一些code,它会提取文件,将它们复制到本地硬盘驱动器,然后创建一个网站或IIS虚拟目录,夸夸其谈,等等。可是,我告诉我应该有一个更简单的方法。像,说,一个WiX的扩展,它已经这样做了。什么的。

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.

注意:的应用程序非常简单。无需数据库,特权,SMTP服务器的配置......或者说,事实上,任何一种配置都没有。只需复制的文件,并创建IIS应用程序。

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.

推荐答案

这可能需要一些编码,但(如果你需要一个pretty的presentable UI)有在Visual Studio生成部署包的功能。

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

在那里将建立你,你的客户可以运行在IIS中创建的所有必要的东西一包,所以IIS设置的应用也是如此。 在Scott Hanselman 有一系列关于它的帖子。您可以从包中更改默认设置/发布设置。

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.

。要部署软件包,你必须 msdeploy.exe 。您可以发送压缩文件夹,当你的客户运行.cmd文件,他们将和在任何时间运行。但是,如果你想要把pretty的蝴蝶结绕包,你可以从C#应用程序疗法将需要编写一些代码运行它,但我敢肯定不会需要超过15分钟。

. 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();