2009-06-13 25 views

cevap

9

Sen WebConfigurationManager kullanarak web.config dosyasını yük olabilir DNS değerini bulmak için, <client> bölümünü almak ve sonra (ismen veya adrese ya da her türlü yoluyla) uygun <endpoint> eleman bulmak ve sonra ayrıntılı olarak inceleyebilirsiniz

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; 
    } 
} 

İlgili sınıflar için System.Web.Configuration ve System.ServiceModel.COnfiguration ad alanlarını kullanmanız gerekir.

Marc

İlgili konular