如何使用C#将应用程序分配给IIS中的特定应用程序池 [英] how to assign application to a particular application pool in IIS using C#

查看:82
本文介绍了如何使用C#将应用程序分配给IIS中的特定应用程序池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这样的功能,一旦我给出了虚拟路径和应用程序名称,应创建两个站点,并将这两个站点链接到一个应用程序池

(例如:如果我给了xxx 作为站点名称,它应该创建两个坐位,即1)xxx2)xxx_WSL和应用程序池名称也xxx)。一切都按预期工作,但唯一的问题是所有应用程序都使用这个新的应用程序池作为他们的应用程序池。



目前我指的是https://msdn.microsoft .com / zh-cn / library / ms525598.aspx。

I need functionality like, Once i gave the Virtual path and application name, that should create two sites, and link those two sites to a single application pool
(ex: if i gave "xxx" as site name it should create two sits namely 1) "xxx" 2) "xxx_WSL" and application pool name also "xxx"). Everything working as expected, but only problem is all the applications use this new application pool as their application pool.

Currently am referring to "https://msdn.microsoft.com/en-us/library/ms525598.aspx".

推荐答案

看起来你总是试图创建新的Applicaiton Pool。



如果您想以编程方式执行此操作,请遵循您共享的相同代码,但只需确保在调用AssignVDirToAppPool时使用相同的AppPool名称,同时调用两个WebApplication。



如果您不想以编程方式执行此操作,那么简单的方法是从IIS服务器管理创建新的(第二个)应用程序,而不是选择Create New AppPool使用现有的应用程序。



注意:您需要确保两个站点都在相同的.Net编译器下构建,并且崩溃一个站点可能会重置两个站点的AppPool。



谢谢

Rushi
It looks like always you are trying to create new Applicaiton Pool.

If you want to do it programatically then follow the same code which you shared but just make sure that you are using same AppPool name while calling AssignVDirToAppPool while calling for both WebApplication.

If you does not want to do it programatically then simple way is while creating new (2nd) application from IIS Server Administration, instead of choosing Create New AppPool use existing one.

Note: You need to make sure that both Sites are build under same .Net compiler and crashing one site may reset AppPool for both of site.

Thanks
Rushi


这篇关于如何使用C#将应用程序分配给IIS中的特定应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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