Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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".
Posted
Updated 21-Oct-15 0:30am
v2
Comments
Nathan Minier 21-Oct-15 7:54am    
A slightly more updated version can be found at:
http://www.iis.net/learn/manage/provisioning-and-managing-iis/provisioning-sample-in-c

Have a look at the System.Web.Administration namespace:
https://msdn.microsoft.com/en-us/library/microsoft.web.administration(v=vs.90).aspx

1 solution

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
 
Share this answer
 
Comments
Member 12070141 27-Oct-15 5:13am    
thanq

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900