मैं अपने क्लाइंट endpoint विन्यास पढ़ने के लिए एसी # नमूना कोड कर सकते हैं:प्रोग्रामिंग के रूप में मैं अपने सी # अनुप्रयोग के वर्तमान अंतराल कैसे खोज सकता हूं?
List<string> addresses = GetMyCurrentEndpoints();
परिणाम के रूप में हम के लिए होता है:
<client>
<endpoint address="http://mycoolserver/FinancialService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFinancialService"
contract="IFinancialService" name="WSHttpBinding_IFinancialService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://mycoolserver/HumanResourcesService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHumanResourceService"
contract="IHumanResourceService" name="WSHttpBinding_IHumanResourceService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
और लक्ष्य अंतिमबिंदुओं पते की एक सरणी प्राप्त करने के लिए है
[0] http://mycoolserver/FinancialService.svc
[1] http://mycoolserver/HumanResourcesService.svc
अच्छा! वेब एप्लिकेशन पर इसका उपयोग करने की कोशिश करने वाले किसी भी व्यक्ति के लिए, आपके पास एक ArgumentException होना चाहिए जैसे 'exePath को केवल स्टैंड के अंदर नहीं चलते समय निर्दिष्ट किया जाना चाहिए।' क्लाइंट सेक्शन पढ़ने के लिए, @Dmitry टिप ठीक है। लेकिन मैं आपका जवाब भी दे रहा हूं! –