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

error in remote call to web.administration in c#

$
0
0

Hi,

Back in the early iis7 days, we created a customized provisioning tool in c#. We rely on shared configuration in our setup.

If you run this application locally on a webserver, all works well. However, parts of the software were updated (same story for the servers, now win2008R2X64/IIS7.5) to allow provisioning from a remote computer.
Thanks to the guide to change DCOM authentication found here: http://learn.iis.net/page.aspx/268/shared-configuration-and-remote-provisioning/ 95% of the functionality (creation of webspaces,...) is going great on the remote computer.

However, altering the delegation of these sites always results in an exception: "specified cast is not valid". What am I missing here?

using (ServerManager serverManager = ServerManager.OpenRemote(Config.WebServer))
                {
                    Configuration config = serverManager.GetAdministrationConfiguration();      ///////////////EXCEPTION: "Specified cast is not valid."      
                    ConfigurationSection authorizationSection = config.GetSection("system.webServer/management/authorization");
                    ConfigurationElementCollection authorizationRulesCollection = authorizationSection.GetCollection("authorizationRules");
                    ConfigurationElement scopeElement = FindElement(authorizationRulesCollection, "scope", "path", pathOfTheSiteToDelegate);
                    if (scopeElement == null)
                    {
                        scopeElement = authorizationRulesCollection.CreateElement("scope");
                        scopeElement["path"] = pathOfTheSiteToDelegate;
                        authorizationRulesCollection.Add(scopeElement);
                    }

                    ConfigurationElementCollection scopeCollection = scopeElement.GetCollection();


Viewing all articles
Browse latest Browse all 27852

Trending Articles



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