2009-06-13 13 views

उत्तर

9

आप WebConfigurationManager का उपयोग कर अपने web.config फ़ाइल को लोड कर सकता है, <client> खंड मिलता है, और उसके बाद उपयुक्त <endpoint> तत्व (नाम से या पते या जो कुछ भी) के द्वारा खोजने के लिए और फिर इसे और गहराई में जाने डीएनएस मूल्य खोजने के लिए:

ClientSection clientSection = (WebConfigurationManager.GetSection("system.serviceModel/client") as ClientSection); 

foreach(ChannelEndpointElement cee in clientSection.Endpoints) 
{ 
    if(cee.Name == "ConfigurationManagerTcp") 
    { 
     IdentityElement ie = cee.Identity; 

     string dnsValue = ie.Dns.Value; 
    } 
} 

आपको शामिल कक्षाओं के लिए System.Web.Configuration और System.ServiceModel.COnfiguration नामस्थानों का उपयोग करने की आवश्यकता होगी।

मार्क

संबंधित मुद्दे