38 lines
1.5 KiB
VB.net
38 lines
1.5 KiB
VB.net
Imports System.ServiceModel
|
|
Imports System.Xml
|
|
|
|
|
|
Public Class Channel
|
|
' Infos about MaxBufferSize and MaxBufferPoolSize
|
|
' https://social.msdn.microsoft.com/Forums/vstudio/en-US/d6e234d3-942f-4e9d-8470-32618d3f3212/maxbufferpoolsize-vs-maxbuffersize?forum=wcf
|
|
|
|
Public Const MAX_RECEIVED_MESSAGE_SIZE = 2147483647 ' 1GB
|
|
Public Const MAX_BUFFER_SIZE = 104857600 ' 100MB
|
|
Public Const MAX_BUFFER_POOL_SIZE = 1048576 ' 1MB
|
|
|
|
Public Const MAX_CONNECTIONS = 500
|
|
Public Const MAX_ARRAY_LENGTH = 2147483647
|
|
Public Const MAX_STRING_CONTENT_LENGTH = 2147483647
|
|
|
|
Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
|
|
Return New NetTcpBinding() With {
|
|
.MaxReceivedMessageSize = MAX_RECEIVED_MESSAGE_SIZE,
|
|
.MaxBufferSize = MAX_BUFFER_SIZE,
|
|
.MaxBufferPoolSize = 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 = MAX_ARRAY_LENGTH,
|
|
.MaxStringContentLength = MAX_STRING_CONTENT_LENGTH
|
|
}
|
|
}
|
|
End Function
|
|
End Class
|
|
|
|
|