2009-06-13 10 views

答えて

9

あなたはWebConfigurationManagerを使用してweb.configファイルを読み込むことができDNS値を見つけるために、<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.ConfigurationSystem.ServiceModel.COnfigurationの名前空間を使用する必要があります。

マーク

関連する問題