EDMI: Include connection strings in client config

This commit is contained in:
Jonathan Jenne
2022-04-04 16:39:53 +02:00
parent d319c87537
commit de451e8c57
4 changed files with 53 additions and 14 deletions

View File

@@ -87,12 +87,8 @@ Public Class Client
Try
ServerAddress = oAddressArray(0)
ServerPort = oAddressArray(1)
Dim oBinding = API.Channel.GetBinding()
Dim oAddress = New EndpointAddress($"net.tcp://{ServerAddress}:{ServerPort}/DigitalData/Services/Main")
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
ChannelFactory = oFactory
Logger.Debug("Connecting to Service at: [{0}]", ServerAddress)
ChannelFactory = GetChannelFactory(ServerAddress, ServerPort)
Catch ex As Exception
Logger.Error(ex)
End Try
@@ -109,20 +105,24 @@ Public Class Client
Logger = LogConfig.GetLogger()
FileEx = New Filesystem.File(LogConfig)
UpdateTimer.Interval = 60 * 1000 * UPDATE_INTERVAL_IN_MINUTES
UpdateTimer.Start()
Try
ServerAddress = IPAddress
Dim oBinding = API.Channel.GetBinding()
Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main")
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
Logger.Debug("Connecting to Service at: [{0}]", oAddress)
ChannelFactory = oFactory
Logger.Debug("Connecting to Service at: [{0}]", IPAddress)
ChannelFactory = GetChannelFactory(IPAddress, PortNumber)
Catch ex As Exception
Logger.Error(ex)
End Try
End Sub
Private Function GetChannelFactory(pIPAddress As String, pPortNumber As Integer) As ChannelFactory(Of IEDMIServiceChannel)
Dim oBinding = API.Channel.GetBinding()
Dim oAddress = New EndpointAddress($"net.tcp://{pIPAddress}:{pPortNumber}/DigitalData/Services/Main")
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
Return oFactory
End Function
''' <summary>
''' Connect to the service
''' </summary>