set logEntireMessage to false to prevent outofmemory exception when importing multiple large files
This commit is contained in:
parent
b78949ae46
commit
86c99f0fc6
@ -42,7 +42,7 @@ Public Class Form1
|
||||
Dim oFileName As String = oItem
|
||||
Dim oFileInfo As New FileInfo(oFileName)
|
||||
|
||||
listboxLog.Items.Add($"Importing {oFileInfo.Name}...")
|
||||
listboxLog.Items.Add($"Importing {oFileInfo.Name}... ({FormatBytes(oFileInfo.Length)})")
|
||||
|
||||
Dim oContents As Byte() = New Byte(oFileInfo.Length) {}
|
||||
|
||||
@ -58,7 +58,6 @@ Public Class Form1
|
||||
End If
|
||||
oSW.Stop()
|
||||
listboxLog.Items.Add($"Import Time: {FormatTime(oSW.ElapsedMilliseconds)}")
|
||||
listboxLog.Items.Add($"File Size: {FormatBytes(oFileInfo.Length)}")
|
||||
listboxLog.Items.Add("")
|
||||
Next
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
|
||||
<behaviors />
|
||||
<bindings>
|
||||
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="tcpBinding"><security mode="None"><transport sslProtocols="None" /></security></Data>" bindingType="netTcpBinding" name="tcpBinding" />
|
||||
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="tcpBinding"><security><transport sslProtocols="None" /></security></Data>" bindingType="netTcpBinding" name="tcpBinding" />
|
||||
</bindings>
|
||||
<endpoints>
|
||||
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://localhost:9000/DigitalData/Services/Main" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="EDMIServiceReference.IEDMIService" name="tcpBinding"><identity><dns value="localhost" /></identity></Data>" digest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://localhost:9000/DigitalData/Services/Main" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="EDMIServiceReference.IEDMIService" name="tcpBinding"><identity><dns value="localhost" /></identity></Data>" contractName="EDMIServiceReference.IEDMIService" name="tcpBinding" />
|
||||
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://localhost:9000/DigitalData/Services/Main" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="EDMIServiceReference.IEDMIService" name="tcpBinding"><identity><servicePrincipalName value="host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works" /></identity></Data>" digest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://localhost:9000/DigitalData/Services/Main" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="EDMIServiceReference.IEDMIService" name="tcpBinding"><identity><servicePrincipalName value="host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works" /></identity></Data>" contractName="EDMIServiceReference.IEDMIService" name="tcpBinding" />
|
||||
</endpoints>
|
||||
</configurationSnapshot>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="iWIOdzq/CtaAM4SQMzp+vG4wC2Y=">
|
||||
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="e9iHagUK3+X05AXstziypKiw8Rs=">
|
||||
<bindingConfigurations>
|
||||
<bindingConfiguration bindingType="netTcpBinding" name="tcpBinding">
|
||||
<properties>
|
||||
@ -81,8 +81,8 @@
|
||||
<property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.NetTcpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.NetTcpSecurityElement</serializedValue>
|
||||
</property>
|
||||
<property path="/security/mode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>None</serializedValue>
|
||||
<property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.SecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>Transport</serializedValue>
|
||||
</property>
|
||||
<property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.TcpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.TcpTransportSecurityElement</serializedValue>
|
||||
@ -156,14 +156,14 @@
|
||||
<property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
<property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue>
|
||||
</property>
|
||||
<property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>localhost</serializedValue>
|
||||
<property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue />
|
||||
</property>
|
||||
<property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue>
|
||||
|
||||
@ -5,6 +5,29 @@
|
||||
<wsp:All>
|
||||
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
|
||||
</msb:BinaryEncoding>
|
||||
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
|
||||
<wsp:Policy>
|
||||
<sp:TransportToken>
|
||||
<wsp:Policy>
|
||||
<msf:WindowsTransportSecurity xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy">
|
||||
<msf:ProtectionLevel>EncryptAndSign</msf:ProtectionLevel>
|
||||
</msf:WindowsTransportSecurity>
|
||||
</wsp:Policy>
|
||||
</sp:TransportToken>
|
||||
<sp:AlgorithmSuite>
|
||||
<wsp:Policy>
|
||||
<sp:Basic256>
|
||||
</sp:Basic256>
|
||||
</wsp:Policy>
|
||||
</sp:AlgorithmSuite>
|
||||
<sp:Layout>
|
||||
<wsp:Policy>
|
||||
<sp:Strict>
|
||||
</sp:Strict>
|
||||
</wsp:Policy>
|
||||
</sp:Layout>
|
||||
</wsp:Policy>
|
||||
</sp:TransportBinding>
|
||||
<wsaw:UsingAddressing>
|
||||
</wsaw:UsingAddressing>
|
||||
</wsp:All>
|
||||
@ -149,7 +172,7 @@
|
||||
<wsa10:EndpointReference>
|
||||
<wsa10:Address>net.tcp://localhost:9000/DigitalData/Services/Main</wsa10:Address>
|
||||
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
|
||||
<Dns>localhost</Dns>
|
||||
<Spn>host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works</Spn>
|
||||
</Identity>
|
||||
</wsa10:EndpointReference>
|
||||
</wsdl:port>
|
||||
|
||||
@ -53,15 +53,17 @@ Public Class Document
|
||||
''' </summary>
|
||||
''' <param name="FilePath">The filename to import</param>
|
||||
''' <returns>A document object</returns>
|
||||
Public Function ImportFile(FilePath As String) As DocumentResult
|
||||
Public Async Function ImportFileAsync(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As Task(Of DocumentResult2)
|
||||
Try
|
||||
Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||
Dim oInfo As New FileInfo(FilePath)
|
||||
Dim oName As String = oInfo.Name
|
||||
Dim oExtension As String = oInfo.Extension.Substring(1)
|
||||
|
||||
Dim oDocObject = _channel.NewFile(oName, oContents)
|
||||
Return oDocObject
|
||||
Using oStream As New FileStream(FilePath, FileMode.Open)
|
||||
Dim oContents As Byte() = {}
|
||||
Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
|
||||
Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod)
|
||||
|
||||
Return oResult
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
@ -73,34 +75,11 @@ Public Class Document
|
||||
''' </summary>
|
||||
''' <param name="FilePath">The filename to import</param>
|
||||
''' <returns>A document object</returns>
|
||||
Public Async Function ImportFile2(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = -1) As Task(Of DocumentResult2)
|
||||
Public Function ImportFile(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As DocumentResult2
|
||||
Try
|
||||
Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||
Dim oInfo As New FileInfo(FilePath)
|
||||
Dim oName As String = oInfo.Name
|
||||
Dim oExtension As String = oInfo.Extension.Substring(1)
|
||||
|
||||
Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod)
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Imports a file by filename
|
||||
''' </summary>
|
||||
''' <param name="FilePath">The filename to import</param>
|
||||
''' <returns>A document object</returns>
|
||||
Public Async Function ImportFileAsync(FilePath As String) As Task(Of DocumentResult)
|
||||
Try
|
||||
Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||
Dim oInfo As New FileInfo(FilePath)
|
||||
Dim oName As String = oInfo.Name
|
||||
Dim oExtension As String = oInfo.Extension.Substring(1)
|
||||
|
||||
Dim oDocObject = Await _channel.NewFileAsync(oName, oContents)
|
||||
Dim oDocObject = _channel.ImportFile(oInfo, oContents, [ReadOnly], RetentionPeriod)
|
||||
Return oDocObject
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
@ -108,45 +87,85 @@ Public Class Document
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Async Function NewFileIndexAsync(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As Task(Of IndexResult)
|
||||
Try
|
||||
Dim oResult As IndexResult = Await _channel.NewFileIndexAsync(DocObject, Syskey, LanguageCode, Value)
|
||||
'''' <summary>
|
||||
'''' Imports a file by filename
|
||||
'''' </summary>
|
||||
'''' <param name="FilePath">The filename to import</param>
|
||||
'''' <returns>A document object</returns>
|
||||
'Public Function ImportFile(FilePath As String) As DocumentResult
|
||||
' Try
|
||||
' Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||
' Dim oInfo As New FileInfo(FilePath)
|
||||
' Dim oName As String = oInfo.Name
|
||||
' Dim oExtension As String = oInfo.Extension.Substring(1)
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
' Dim oDocObject = _channel.NewFile(oName, oContents)
|
||||
' Return oDocObject
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
|
||||
Try
|
||||
Dim oResult As IndexResult = _channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value)
|
||||
'''' <summary>
|
||||
'''' Imports a file by filename
|
||||
'''' </summary>
|
||||
'''' <param name="FilePath">The filename to import</param>
|
||||
'''' <returns>A document object</returns>
|
||||
'Public Async Function ImportFileAsync(FilePath As String) As Task(Of DocumentResult)
|
||||
' Try
|
||||
' Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||
' Dim oInfo As New FileInfo(FilePath)
|
||||
' Dim oName As String = oInfo.Name
|
||||
' Dim oExtension As String = oInfo.Extension.Substring(1)
|
||||
|
||||
Return oResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
' Dim oDocObject = Await _channel.NewFileAsync(oName, oContents)
|
||||
' Return oDocObject
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Public Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult
|
||||
Try
|
||||
Return _channel.GetDocumentByDocumentId(DocumentId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
'Public Async Function NewFileIndexAsync(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As Task(Of IndexResult)
|
||||
' Try
|
||||
' Dim oResult As IndexResult = Await _channel.NewFileIndexAsync(DocObject, Syskey, LanguageCode, Value)
|
||||
|
||||
Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
|
||||
Try
|
||||
Return _channel.GetDocumentByContainerId(ContainerId)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
' Return oResult
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
|
||||
' Try
|
||||
' Dim oResult As IndexResult = _channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value)
|
||||
|
||||
' Return oResult
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult
|
||||
' Try
|
||||
' Return _channel.GetDocumentByDocumentId(DocumentId)
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
'Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
|
||||
' Try
|
||||
' Return _channel.GetDocumentByContainerId(ContainerId)
|
||||
' Catch ex As Exception
|
||||
' _logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
''' <summary>
|
||||
''' Aborts the channel and creates a new connection
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<bindings>
|
||||
<netTcpBinding>
|
||||
<binding name="tcpBinding">
|
||||
<security mode="None">
|
||||
<security>
|
||||
<transport sslProtocols="None" />
|
||||
</security>
|
||||
</binding>
|
||||
@ -37,7 +37,7 @@
|
||||
binding="netTcpBinding" bindingConfiguration="tcpBinding"
|
||||
contract="EDMIServiceReference.IEDMIService" name="tcpBinding">
|
||||
<identity>
|
||||
<dns value="localhost" />
|
||||
<servicePrincipalName value="host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works" />
|
||||
</identity>
|
||||
</endpoint>
|
||||
</client>
|
||||
|
||||
@ -31,13 +31,15 @@
|
||||
</source>
|
||||
</sources>
|
||||
<sharedListeners>
|
||||
<add initializeData="C:\logs\TracingAndLogging-service.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="xml"/>
|
||||
<add name="xml"
|
||||
initializeData="C:\logs\TracingAndLogging-service.svclog"
|
||||
type="System.Diagnostics.XmlWriterTraceListener" />
|
||||
</sharedListeners>
|
||||
<trace autoflush="true"/>
|
||||
</system.diagnostics>
|
||||
<system.serviceModel>
|
||||
<diagnostics wmiProviderEnabled="true">
|
||||
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
|
||||
<messageLogging logEntireMessage="false" logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
|
||||
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true"/>
|
||||
</diagnostics>
|
||||
<bindings>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user