如何在 Web 安装项目中创建新的应用程序池? [英] How can I create a new application pool in a Web Setup Project?

查看:32
本文介绍了如何在 Web 安装项目中创建新的应用程序池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要部署我的网络服务.它需要使用自己的凭据在 IIS 中的单独应用程序池中运行.

I need to deploy my web service. It needs to run in a separate application pool in IIS with its own credentials.

是否可以通过在 VS 2008 中使用 Web 安装项目来做到这一点?

Is it possible to do this by using a Web Setup Project in VS 2008?

默认情况下,我似乎只能选择现有的应用程序池.

By default, I seem to only be able to choose an existing application pool.

推荐答案

我以前一直在这条路上走,不幸的是,您需要手动创建应用程序池或编写自定义操作来为您管理它.

I've been down this road before and unfortunately you'll need to create the application pool manually or write a Custom Action to manage this for you.

在下面的评论中进一步讨论 Grzenio 的问题:

Further to Grzenio's question in the comments below:

您能给我一个提示,从哪里开始寻找代码/帮助程序类吗?您将项目保留为 Web 安装项目,还是仅使用标准的应用程序安装项目?"

我向包含安装项目的解决方案添加了一个名为 InstallHelper 的新项目.在那个项目中,我创建了一个名为 InstallActions 的类,它派生自:

I added a new project called InstallHelper to the solution containing the setup project. In that project I created a class called InstallActions which derives from:

System.Configuration.Install.安装程序 (MSDN).

System.Configuration.Install.Installer (MSDN).

您可以在 Installer 基类上覆盖四种方法,以允许您根据安装程序运行时是处于安装、提交、卸载还是回滚阶段来指定自定义操作.

There are four methods you can override on the Installer base class to allow you to specify custom actions depending on whether you're in the Install, Commit, Uninstall or Rollback phases when the installer is running.

我还在设置项目用户界面中添加了一些文本框对话框.从这些对话中捕获的输入和状态通过字典传递给您的自定义安装操作.即:

I also added a number of text box dialogues to the setup project user interface. Input and state captured from these dialogues is passed to your custom install action via a dictionary. i.e.:

using System.Collections.Specialized;
using System.ComponentModel;
using System.Configuration.Install;
using System.Windows.Forms;

namespace InstallHelper
{
  [RunInstaller(true)]
  public partial class PostInstallActions : Installer
  {   
    public override void Install(IDictionary state)
    {
      base.Install(state);
      // Do my custom install actions
    }

    public override void Commit(IDictionary state)
    {
      base.Commit(state);
      // Do my custom commit actions
    }

    public override void Uninstall(IDictionary state)
    {
      base.Uninstall(state);
      // Do my custom uninstall actions
    }
    public override void Rollback(IDictionary state)
    {
      base.Uninstall(state);
      // Do my custom rollback actions
    }
  }
}

要将自定义操作项目添加到设置项目,请打开自定义操作查看器/编辑器并指定 InstallHelper 项目的输出.

To add your custom action project to the setup project, open the Custom Actions viewer/editor and specify the output from the InstallHelper project.

这是基础知识,应该可以帮助您入门.Web 设置项目还支持自定义操作和其他用户输入对话框,因此除了自定义操作外,您可能希望重新使用现有项目.

That's the basics and should get you started. The Web Setup Project also supports custom actions and additional user input dialogue boxes, so you may wish to re-use your existing project, in addition to a custom action.

这篇关于如何在 Web 安装项目中创建新的应用程序池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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