Modify values for WCF config in app.config

  • Thread starter Alhambra Eidos Desarrollo
  • Start date

A

Alhambra Eidos Desarrollo

Hi misters,



i have an app.config of my App that uses WCF.



I need change the configuration servicemodel, and I want update somes values.



//standard method from System.Configuration
Configuration appConfig = ConfigurationManager.OpenExeConfiguration( "Path
to my App.config");

//the main section in the app.config file for WCF
ServiceModelSectionGroup serviceModel =
ServiceModelSectionGroup.GetSectionGroup( appConfig );



First, how can I set values for modify some endpoint address, for change
localhost and port and set another values.



<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NewBinding0" maxReceivedMessageSize="100000000">
<readerQuotas maxArrayLength="163840000" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="None"
/>
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8090/ServicioBase/servicio"
binding="netTcpBinding" bindingConfiguration="NewBinding0"
contract="GRUPOBACKUP.WCF.ServicioBase.Contrato.IServicioBase"
name="AgenteServicioBase" />
<endpoint address="net.tcp://localhost:8091/ServicioLog/servicio"
binding="netTcpBinding" bindingConfiguration="NewBinding0"
contract="GRUPOBACKUP.WCF.Log.Contrato.ILog"
name="AgenteLog" />
</client>
</system.serviceModel>



Then, how I can refresh section or app.config ? using
System.Configuration.ConfigurationManager.RefreshSection(...) ???


ConfigurationManagerRefreshSection("system.serviceModel")
ConfigurationManager.RefreshSection("system.serviceModel/services")
ConfigurationManager.RefreshSection("system.serviceModel/bindings")



Any ideas, suggestions, comments ?

Thanks in advance, greetings, your help is very grateful !!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top