Modules/EDMI_ClientSuite/ClassInit.vb
Jonathan Jenne 94376068d6 jj
2019-01-23 17:22:13 +01:00

41 lines
1.6 KiB
VB.net

Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Logging.LogConfig
Imports System.ServiceModel
Imports EDMI_ClientSuite.NetworkService_DDEDM
Public Class ClassInit
Private Const OPEN_TIMEOUT = 10
Private Const MAX_MESSAGE_SIZE = 2147483647
Private Const MAX_BUFFER_SIZE = 2147483647
Private Const MAX_ARRAY_LENGTH = 2147483647
Private Const MAX_STRING_LENGTH = 2147483647
Private Const MAX_CONNECTIONS = 10000
Public Property _LogConfig As LogConfig
Public Sub New()
_LogConfig = New LogConfig(PathType.AppData)
End Sub
Public Function CreateService() As ChannelFactory(Of IEDMServiceChannel)
Return CreateChannelFactory()
End Function
Private Function CreateChannelFactory() As ChannelFactory(Of IEDMServiceChannel)
Dim oBinding As New NetTcpBinding()
oBinding.Security.Mode = SecurityMode.Transport
oBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows
oBinding.MaxReceivedMessageSize = MAX_MESSAGE_SIZE
oBinding.MaxBufferSize = MAX_BUFFER_SIZE
oBinding.MaxBufferPoolSize = MAX_BUFFER_SIZE
oBinding.MaxConnections = MAX_CONNECTIONS
oBinding.ReaderQuotas.MaxArrayLength = MAX_ARRAY_LENGTH
oBinding.ReaderQuotas.MaxStringContentLength = MAX_STRING_LENGTH
oBinding.OpenTimeout = New TimeSpan(0, 0, OPEN_TIMEOUT)
Dim oEndpointAddress = New EndpointAddress(My.Settings.EDM_NetworkService_Adress)
Return New ChannelFactory(Of IEDMServiceChannel)(oBinding, oEndpointAddress)
End Function
End Class