2

I'm using the following method to create application pool and assign it to web site.

This is code for application pool creation:

WebSiteName = some website name which existed.

I see that all values are get where they should be in debug mode

 private void ConfiugreAppPoolIIS7(targetMachine)
    {
        var mgr =  ServerManager.OpenRemote(targetMachine);

        if (AppPoolProp.ContainsKey("SomeTestAppPool"))
        {
            string reqAppPool = AppPoolProp["SomeTestAppPool"];

            if (!mgr.ApplicationPools.Any(pool => pool.Name == reqAppPool))
            {
                ApplicationPool myApp = mgr.ApplicationPools.Add(reqAppPool);
                myApp.AutoStart = true;
                myApp.ManagedPipelineMode = ManagedPipelineMode.Classic;
                myApp.ManagedRuntimeVersion = "V4.0";
                myApp.ProcessModel.IdentityType = ProcessModelIdentityType.NetworkService;
                myApp.Enable32BitAppOnWin64 = true;

                mgr.CommitChanges();

                foreach (Site site in mgr.Sites)
                {
                   if(site.Name == WebSiteName)
                   {
                       site.Stop();
                       site.ApplicationDefaults.ApplicationPoolName = myApp.Name;
                       site.Start();
                       mgr.CommitChanges();
                   }

                }

            }

        }
    }

The result is, I see the Aplication pool created successfuly, and the Website created as well, but, I see in the advanced settings of my web site the default appplication pool is assigned.

Could you please help?

1 Answer 1

2

The problem has been fixed by fixing reference to right Microsoft.Web.Administration.dll

Cause of this server manage connected to express iis instead of my local iis.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.