Sunday, 1 March 2015

C# Change baseAddress in app.config




`<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<services>
<service name="IBSCommService.CommService" behaviorConfiguration="mexBehaviour">
<endpoint address="IBSCommService" binding="basicHttpBinding" contract="IBSCommService.ICommService"></endpoint>
<!--<endpoint address="IBSCommService" binding="netTcpBinding" contract="IBSCommService.ICommService"></endpoint>-->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://ift.tt/1E89uPv"/>
<!--<add baseAddress="net.tcp://localhost:8090/"/>-->
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>`


I need to change the baseAddress using UI so that users can specify the baseAddress to use.


I have google alot, and cant seem to found a solution to access the baseAddress. Most are how to access keys in the app.config file.


No comments:

Post a Comment