After running for a while, the C project calls the C# WCF interface and an Out of memory Exception occurs

Aspire 81 Reputation points
2020-06-29T05:00:49.193+00:00

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.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
42,172 questions
0 comments No comments
{count} votes

Accepted answer
  1. Roy Li - MSFT 34,091 Reputation points Microsoft Vendor
    2020-06-29T06:15:19.407+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Currently, Microsoft Q&A supports the products listed over here: supported topics (more to be added later on).

    Your question about WCF is not supported yet now. You could ask about this in the Windows Communication Foundation, Serialization, and Networking forum.

    Thank you.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.