什么是部署在Web服务器上的可执行程序的最佳方法是什么? [英] What's the best way to deploy an executable process on a web server?

查看:221
本文介绍了什么是部署在Web服务器上的可执行程序的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题的标题可能会有点笨拙措辞,但这里的情况:

The title of this question might be a bit clumsily phrased, but here's the situation:

我有我的部署服务器上的.NET Web项目。它仍处于测试阶段,所以有很多的释放和再释放情况的发生。

I have a .NET web project deployed on my server. It's still in beta, so there's a lot of releasing and re-releasing happening.

我也写为C#可执行在相同的VS溶液(称之为ADMIN.EXE),它运行在服务器上的背景下,周期性地执行某些业务规则完整性检查和进行适当的插入,以警告表中DB。

I have also written a C# executable in the same VS solution (call it "admin.exe") that runs in the background on the server, periodically performing certain business rule integrity checks and making appropriate insertions to a warning table in the DB.

问题是:什么是部署这个应用程序的最佳途径,使其得到更新,每当我提出一个新的版本?应该运行所有的时间在版本之间,所以最好我想某种设置,由此关机部署,启动过程中涉及的步骤的最小可能的数量。

Question is: what's the best way to deploy this app so that it gets updated whenever I make a new release? It should be running all the time in between releases, so ideally I'd like some sort of setup whereby the shutdown-deploy-startup process involves the minimum possible number of steps.

谢谢!

给出的答案迄今已经有益和有趣的,但还没有给我提供了一个清晰,简明和优雅的解决方案。请不要以为我有部署项目的广博的知识,因为我不知道。赏金去谁可以提供一个解决方案,执行以下的人:

The answers given thus far have been helpful and interesting, but haven't provided me with a clear, concise and elegant solution. Please do not assume I have extensive knowledge of deployment projects, because I don't. Bounty goes to the person who can provide a solution that does the following:

  1. 发布的最新版本的网站;
  2. 关闭ADMIN.EXE的是在服务器上运行的任何情况;
  3. 更新ADMIN.EXE;
  4. 在启动ADMIN.EXE;
  5. 所有上述应做preferably在一个步骤中,或为几个步骤越好,看到它会反复整个产品的寿命来完成的;和
  6. 在上述所有应该做的$ P $的pferably,而不需要安装任何第三方软件。

感谢您的帮助!

小编辑 - 澄清

我想了很多目前提供的解决方案都高估了问题的复杂性,所以让我澄清一下:一切要部署,只需要部署在一个电脑,这也有愉快的Visual Studio适用于所有源$ C ​​$ C。我只需要(1)发布网站到Web文件夹,和(2)关闭,重新安装和重新启动ADMIN.EXE在同一台服务器上。是不是有一步到位这样做的一个简单的方法?它可以用VS部署项目办呢?

I think a lot of the solutions offered thus far have overestimated the complexity of the problem, so let me clarify: everything that is to be deployed, only has to be deployed on one computer, which also happily has Visual Studio available with all source code. I only need to (1) publish the web site to the web folder, and (2) shut down, reinstall and restart admin.exe on the same server. Isn't there a simple way of doing this in one step? Can it be done with a VS Deployment project?

推荐答案

正确的方法可能是设置部署脚本和安装,但能够只需点击发布的Visual Studio和跳过与远程桌面去的是很多开发过程中更方便。

The "correct" way is probably to set up deployment scripts and installers, but being able to just click publish in Visual Studio and skip going in with remote desktop is a lot more convenient during development.

我有一个管理Web应用程序,它作为一个前端到命令行应用程序 - 从你在做什么略有不同,但相同的解决方案应该工作

I have an admin web app that acts as a front end to a command line app - slightly different from what you are doing, but the same solution should work.

只是一个引用添加到管理员的Web应用程序的控制台项目。即使你不叫控制台项目中的任何方法,引用会导致控制台应用程序来进行重建,当你发布管理网站上传。

Simply add a reference to the console project in the admin web app. Even though you don't call any methods in the console project, the reference will cause the console app to be rebuilt and uploaded when you publish the admin website.

一个简单的启动/停止页面添加到Web应用程序需要的步骤2和护理; 4 - 矿山调用的Process.Start()/ Process.Kill(),虽然你明明有一个更清洁关机的选项取决于ADMIN.EXE的设置

A simple start/stop page added to the web app takes care of steps 2 & 4 - Mine calls Process.Start()/Process.Kill(), though you obviously have the option of a cleaner shutdown depending on the setup of admin.exe.

下面是从我开始的code /停止网页 - 我把它们设置为Web服务方法(能够方便一些监测的东西,你可能不会需要),但他们应该刚从以及所谓的简单的按钮点击的方法。需要注意的是该服务帐户将需要的权限来运行/停止的过程 - 在开发框最简单的方法是设置IIS作为一个管理员用户,而不是默认的服务帐户运行

Below is the code from my start/stop page - I have them set up as web service methods (to facilitate some monitoring stuff you probably won't need), but they should work just as well called from a simple button click method. Note that the service account will need permission to run/stop the process - on a dev box the simplest option is to set up iis to run as an admin user rather than the default service account.

    private void KillProcess(string name)
    {
        var binpath = Server.MapPath("~/bin");
        var pp2 = Process.GetProcesses();

        var pp = from p in pp2 where p.ProcessName.Contains(name) && !p.ProcessName.Contains("vshost") select p;
        foreach (var p in pp)
        {
            p.Kill();
        }
    }

[WebMethod]
    public void StartQueueRunner()
    {
        var binpath = Server.MapPath("~/bin");
        System.Diagnostics.Process.Start(Path.Combine(binpath, "TwoNeeds.QueueRunner.exe"));
    }

[WebMethod]
    public void StartQueueRunner()
    {
        var binpath = Server.MapPath("~/bin");
        System.Diagnostics.Process.Start(Path.Combine(binpath, "TwoNeeds.QueueRunner.exe"));
    }

这篇关于什么是部署在Web服务器上的可执行程序的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆