Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 26542

Deployment API and Application Pool Recycling with WMSVC

$
0
0

Hi all

I am successfully using the Web.Deployment API for application pool recycling, the code is attached here:

class Program {

        private static void Main(string[] args) {

            ServicePointManager.ServerCertificateValidationCallback = (s, c, chain, err) => true;

            var syncOptions = new DeploymentSyncOptions();
          
            var destBaseOptions = new DeploymentBaseOptions {
                AuthenticationType = "ntlm",
                UseDelegation = true,
                ComputerName = "MyServer",
            };

            var providerOptions = new DeploymentProviderOptions(DeploymentWellKnownProvider.RecycleApp);
            providerOptions.ProviderSettings["recycleMode"].Value = "RecycleAppPool";
            providerOptions.Path = "My Services";
            try {
                using (var depObject = DeploymentManager.CreateObject(providerOptions, destBaseOptions)) {
                    try {
                        var summary = depObject.SyncTo(DeploymentWellKnownProvider.Auto, string.Empty, destBaseOptions, syncOptions);
                        Console.WriteLine("Total Changes: {0}",summary.TotalChanges);
                    }
                    catch (Exception e) {
                        Console.WriteLine(e.Message);
                    }
                }
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
    }

This code basically correlates to the following commandine:

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="My Services",computerMame=MyServer,recycleMode="RecycleAppPool",authType=ntlm -allowUntrusted

This is perfectly ok for someone with Administrative priviledges. Since I have setup the server for delegation, I would like to rewrite the C# code above to correlate to this commandline, using the web deployment agent:

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="My Services",wmsvc=MyServer,recycleMode="RecycleAppPool",authType=ntlm -allowUntrusted

So far I have not found out, how I need to specify the wmsvc=MyServer option in C#. 

Any help appreciated.

Thanks






Viewing all articles
Browse latest Browse all 26542

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>