After running for a period of time, Out of memory Exception occurs when C++ project calls C# WCF interface.
WCF Client:
NetTcpBinding Bindings = new NetTcpBinding();
Bindings.Security.Mode = SecurityMode.None;
Bindings.MaxReceivedMessageSize = 2147483647;
ChannelFactory<MyWCFClient> myWCFFactory = new ChannelFactory<MyWCFClient>(Bindings, serverAddress);
If(myWCFFactory == null)
return;
MyWCFClient channel = myWCFFactory.CreateChannel();
If(channel == null)
return;
try
{
switch(((IClientChannel)channel).State)
{
case CommunicationState.Faulted:
((IClientChannel)channel).Abort();
channel = myWCFFactory.CreateChannel();
((IClientChannel)channel).Open();
break;
case CommunicationState.Opened:
break;
case CommunicationState.Closed:
channel = myWCFFactory.CreateChannel();
((IClientChannel)channel).Open();
break;
case CommunicationState.Created:
((IClientChannel)channel).Open();
break;
default:
((IClientChannel)channel).Abort();
channel = null;
break;
}
}
catch
{
}
WCF Service:
static ServiceHost myServiceHost = new ServiceHost(….);
NetTcpBinding Bindings = new NetTcpBinding();
Bindings.CloseTimeout = TimeSpan.Parse(“00:01:00”);
Bindings.OpenTimeout = TimeSpan.Parse(“00:01:00”);
Bindings.ReceiveTimeout = TimeSpan.Parse(“00:01:00”);
Bindings.SendTimeout = TimeSpan.Parse(“00:01:00”);
Bindings.TransactionFlow = false;
Bindings.TransferMode = TransferMode.Buffered.
Bindings.MaxBufferPoolSize = 1024;
Bindings.MaxBufferSize = 1073741824;
Bindings.MaxReceivedMessageSize = 1073741824;
Bindings.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
Bindings.ReaderQuotas.MaxDepth = 64;
Bindings.ReaderQuotas.MaxArrayLength = 2147483647;
Bindings.ReaderQuotas.MaxStringContentLength = 2147483647;
Bindings.ReaderQuotas.MaxNameTableCharCount = 2147483647;
Bindings.ReaderQuotas.MaxBytesPerRead = 2147483647;
Bindings.ReliableSession.InactivityTimeout = TimeSpan.Parse(“00:01:00”);
Bindings.ReliableSession.Ordered = true;
Bindings.ReliableSession.Enabled = false;
Bindings.Security.Mode = SecurityMode.None;
myServiceHost.AddServiceEndPoint(…,Bindings,….);
Is there any configuration error?
In the interface where the error occurs, the length of the parameter is a fixed value, which is a string of GUID strings, so it is unclear what caused it.