Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We are accessing default port number using ServerManager class from IIS in customer machines. But the Console didn’t run some of the machines and show Microsoft.Web.Administration.dll is required. Is this assembly is Redistributable? Or Is there any other way to get the default Port number? I am using below code to get the Port Number.

using (ServerManager serverManager = new ServerManager())
        {
            SiteCollection allsites = serverManager.Sites;
            foreach (Site site in allsites)
            {
                if (site.Name == "Default Web Site")
                {
                    BindingCollection allBindings = site.Bindings;
                    foreach (Binding bind in allBindings)
                    {
                        if (bind.Protocol == "http")
                        {
                            PortNo = bind.BindingInformation.ToString();
                            int portNoLenth = PortNo.Length; PortNo = PortNo.Substring(2, portNoLenth - 3); break;
                        }
                    }
                }
            }
        }

Please help me to solve this issue.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
779 views
Welcome To Ask or Share your Answers For Others

1 Answer

No, it is not redistrbutable, it should be installed in the machine with IIS. Even if you did, the likelihood is it will not work since it has dependencies on other libraries (native code DLLs) that need to exist and be registered.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...