I have a pretty simple TimeClock application written in VB (.net4) that I'm trying to add to. The addition will allow the user to change where the service is coming from.
In short, I want to be able to programatically change the in the App.Config file.
For reference:
<client>
<endpoint address="net.tcp://localhost:8090/MyService/TimeClockService"
binding="netTcpBinding"
contract="TimeClockService.ITimeClock"
name="tcpBinding">
<identity>
<userPrincipalName value="susnick-PC\susnick" />
</identity>
</endpoint>
</client>
The only part i'm really trying to change is the 'address'.
So far, i've seen some help on this site dealing with this in C# but I couldn't get it to work just right. Here is what i have so far. The 'newIp.text' is a text box that will allow the user to change the IP address.
Dim newAddress As String
newAddress = "http://" & newIP.Text & "/"
Dim uri As Uri = New Uri(newAddress)
Dim address = New EndpointAddress(uri)
The code will return the new uri as whatever IP address i type in. However, it doesn't update the App.config file with the new settings. Any help is appreciated.