Click here to Skip to main content
15,892,480 members
Home / Discussions / C#
   

C#

 
GeneralRe: Finding a custom event using reflection Pin
Clive D. Pottinger15-Nov-11 6:18
Clive D. Pottinger15-Nov-11 6:18 
GeneralRe: Finding a custom event using reflection Pin
Clive D. Pottinger15-Nov-11 15:30
Clive D. Pottinger15-Nov-11 15:30 
AnswerRe: Finding a custom event using reflection Pin
Luc Pattyn15-Nov-11 15:37
sitebuilderLuc Pattyn15-Nov-11 15:37 
GeneralRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 22:14
CDP180215-Nov-11 22:14 
GeneralRe: Finding a custom event using reflection Pin
Wayne Gaylard15-Nov-11 22:35
professionalWayne Gaylard15-Nov-11 22:35 
GeneralRe: Finding a custom event using reflection Pin
CDP180215-Nov-11 22:54
CDP180215-Nov-11 22:54 
GeneralRe: Finding a custom event using reflection Pin
BobJanova16-Nov-11 3:03
BobJanova16-Nov-11 3:03 
QuestionAssigned AppPool resets after completion of Web Deployment Setup when using Custom Actions Pin
www.Developerof.NET15-Nov-11 2:22
www.Developerof.NET15-Nov-11 2:22 
Hi,

I have an Web Application developed in .NET Framework 4.0 and created an deployment setup for the same. The client requirement is to create an custom Apppool and assign it to the virtual directory which is currently installing. To address this issue i created an custom actions project as described in following article.

http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx[^]

I wrote the following code to create an apppool and assign it to the virtual directory.

   private void CreateAppPoolIIS7()
        {
            using (ServerManager serverManager = new ServerManager())
            {
                string appPoolName = this.Context.Parameters["APPPOOL"];
                ApplicationPool newPool;
                newPool = serverManager.ApplicationPools.FirstOrDefault(x => x.Name == appPoolName);
                if (newPool == null)
                    newPool = serverManager.ApplicationPools.Add(appPoolName);
                newPool.ManagedRuntimeVersion = "v4.0";
                newPool.ManagedPipelineMode = ManagedPipelineMode.Classic;
                serverManager.CommitChanges();
            }
        }
        private void AssignIIS7AppPoolToVirDir()
        {
            using (ServerManager serverManager = new ServerManager())
            {
                // Find Default Website
                Microsoft.Web.Administration.Application newApp = null;
                string appPoolName = this.Context.Parameters["APPPOOL"];
// Get the Root website
                Site site = serverManager.Sites.First(s => s.Id == 1);
                string installpath = this.Context.Parameters["INSTALLDIR"];
                installpath = installpath.TrimEnd('\\');
//Get the name of the virtual directory
                string virdirname = "/" + installpath.Substring(installpath.LastIndexOf('\\') + 1);

                newApp = site.Applications.FirstOrDefault(x => x.Path == virdirname);
                if (newApp != null)
                {
                    newApp.ApplicationPoolName = appPoolName;
                    serverManager.CommitChanges();
                }
                else
                {
                    MessageBox.Show("Website not found");
                }
           }
        }


I call these methods in the Install event of the installer as follows..

C#
 public override void Install(IDictionary stateSaver)
        {
         .......
CreateAppPoolIIS7();
AssignIIS7AppPoolToVirDir();


The assigned app pool is reflected in the IIS as long as the control is in the custom action project. The apppool resets back to the default selected at the start of the installer once the setup exits the custom action project.

It would be grateful if some one could help.
When you fail to plan, you are planning to fail.

QuestionUnable to add event handler for Minimizing the Ribbon Control in WPF Pin
Kushagra Tiwari15-Nov-11 2:10
Kushagra Tiwari15-Nov-11 2:10 
AnswerRe: Unable to add event handler for Minimizing the Ribbon Control in WPF Pin
JF201515-Nov-11 3:27
JF201515-Nov-11 3:27 
QuestionSynchronous webservice calls briefly freeze up multithreaded application Pin
CDP180215-Nov-11 1:27
CDP180215-Nov-11 1:27 
AnswerRe: Synchronous webservice calls briefly freeze up multithreaded application Pin
BobJanova15-Nov-11 2:41
BobJanova15-Nov-11 2:41 
GeneralRe: Synchronous webservice calls briefly freeze up multithreaded application Pin
CDP180215-Nov-11 3:09
CDP180215-Nov-11 3:09 
QuestionCan anyone explain how this Regex works? Pin
fiaolle14-Nov-11 22:17
fiaolle14-Nov-11 22:17 
AnswerRe: Can anyone explain how this Regex works? Pin
PIEBALDconsult15-Nov-11 1:53
mvePIEBALDconsult15-Nov-11 1:53 
AnswerRe: Can anyone explain how this Regex works? Pin
BillWoodruff15-Nov-11 2:28
professionalBillWoodruff15-Nov-11 2:28 
AnswerRe: Can anyone explain how this Regex works? Pin
BobJanova15-Nov-11 2:47
BobJanova15-Nov-11 2:47 
QuestionCompiling x86 - x64 Pin
V.14-Nov-11 22:07
professionalV.14-Nov-11 22:07 
GeneralRe: Compiling x86 - x64 Pin
harold aptroot14-Nov-11 22:45
harold aptroot14-Nov-11 22:45 
GeneralRe: Compiling x86 - x64 Pin
V.14-Nov-11 22:57
professionalV.14-Nov-11 22:57 
GeneralRe: Compiling x86 - x64 Pin
Pete O'Hanlon14-Nov-11 23:04
mvePete O'Hanlon14-Nov-11 23:04 
GeneralRe: Compiling x86 - x64 Pin
V.14-Nov-11 23:21
professionalV.14-Nov-11 23:21 
GeneralRe: Compiling x86 - x64 Pin
harold aptroot14-Nov-11 23:07
harold aptroot14-Nov-11 23:07 
GeneralRe: Compiling x86 - x64 Pin
V.14-Nov-11 23:24
professionalV.14-Nov-11 23:24 
GeneralRe: Compiling x86 - x64 Pin
harold aptroot15-Nov-11 0:19
harold aptroot15-Nov-11 0:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.