Messaging: Add binding class
This commit is contained in:
31
Messaging/WCF/Binding.vb
Normal file
31
Messaging/WCF/Binding.vb
Normal file
@@ -0,0 +1,31 @@
|
||||
Imports System.Net
|
||||
Imports System.ServiceModel
|
||||
Imports System.Xml
|
||||
|
||||
Namespace WCF
|
||||
Public Class Binding
|
||||
Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
|
||||
Return New NetTcpBinding() With {
|
||||
.MaxReceivedMessageSize = Constants.ChannelSettings.MAX_RECEIVED_MESSAGE_SIZE,
|
||||
.MaxBufferSize = Constants.ChannelSettings.MAX_BUFFER_SIZE,
|
||||
.MaxBufferPoolSize = Constants.ChannelSettings.MAX_BUFFER_POOL_SIZE,
|
||||
.TransferMode = TransferMode.Streamed,
|
||||
.Security = New NetTcpSecurity() With {
|
||||
.Mode = SecurityMode.Transport,
|
||||
.Transport = New TcpTransportSecurity() With {
|
||||
.ClientCredentialType = AuthenticationMode
|
||||
}
|
||||
},
|
||||
.ReaderQuotas = New XmlDictionaryReaderQuotas() With {
|
||||
.MaxArrayLength = Constants.ChannelSettings.MAX_ARRAY_LENGTH,
|
||||
.MaxStringContentLength = Constants.ChannelSettings.MAX_STRING_CONTENT_LENGTH
|
||||
}
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Shared Function GetAddress(pHost As String, pPort As Integer, pName As String) As Uri
|
||||
Return New Uri($"net.tcp://{pHost}:{pPort}/DigitalData/Services/{pName}")
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user