5
मैं कॉन्फ़िगरेशन फ़ाइल से endpointIdentity कैसे प्राप्त करूं?कॉन्फ़िगरेशन फ़ाइल से एंडपॉइंट पढ़ना
मैं कॉन्फ़िगरेशन फ़ाइल से endpointIdentity कैसे प्राप्त करूं?कॉन्फ़िगरेशन फ़ाइल से एंडपॉइंट पढ़ना
आप 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
नामस्थानों का उपयोग करने की आवश्यकता होगी।
मार्क