Vb.net 以编程方式更改App.config中的端点地址

Vb.net 以编程方式更改App.config中的端点地址,vb.net,uri,endpoint,Vb.net,Uri,Endpoint,我有一个用VB(.net4)编写的非常简单的时钟应用程序,我正试图添加到其中。添加内容将允许用户更改服务的来源 简而言之,我希望能够通过编程更改App.Config文件中的 供参考: <client> <endpoint address="net.tcp://localhost:8090/MyService/TimeClockService" binding="netTcpBinding"

我有一个用VB(.net4)编写的非常简单的时钟应用程序,我正试图添加到其中。添加内容将允许用户更改服务的来源

简而言之,我希望能够通过编程更改App.Config文件中的

供参考:

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

代码将以我键入的任何IP地址返回新的uri。但是,它不会使用新设置更新App.config文件。非常感谢您的帮助。

看看这个:使用app.config方法创建客户端将有一个静态地址。请仔细检查一下,我的方向是正确的——我有一个客户端和服务应用程序。我将能够在客户端上有一个按钮来更新客户端应用程序中的App.Config,对吗?客户端不应该真正更改App.Config。相反,不要使用app.config创建客户端,只需通过编程方式创建客户端。
Dim newAddress As String

    newAddress = "http://" & newIP.Text & "/"

Dim uri As Uri = New Uri(newAddress)
    Dim address = New EndpointAddress(uri)