WCF service is not responding after a particular number of calls. RRS feed

  • Question

  • Hi I have a wcf service hosted in a console application,i mean self hosting.

    What i am doing is i am calling the same operation contract inside a loop but after a number of execution,in my case 812 number of times its executed.

    But after that its not responding.

    my app.config

            <binding name="netTcp" receiveTimeout="24.20:31:23" sendTimeout="24.20:31:23"
              maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000">
              <readerQuotas maxDepth="500" maxStringContentLength="50000000"
                maxArrayLength="50000000" maxBytesPerRead="50000000" maxNameTableCharCount="50000000" />
              <reliableSession inactivityTimeout="24.20:31:23" enabled="true" />
              <security mode="None"></security>
          <service name="MI.NM.SNAC.HardwareInterface.Motion.ServiceImpl.HelloService">
            <endpoint address="HelloService" binding="netTcpBinding" contract="MI.NM.SNAC.HardwareInterface.Motion.Contracts.Interfaces.IHelloService" bindingConfiguration="netTcp">
                <dns value="localhost" />
            <endpoint address="HelloService/mex" binding="mexTcpBinding"
              contract="IMetadataExchange" />
                <add baseAddress="net.tcp://localhost:8456/Hello" />

              <!-- To avoid disclosing metadata information, 
              set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="False" httpsGetEnabled="False" />
              <!-- To receive exception details in faults for debugging purposes, 
              set the value below to true.  Set to false before deployment 
              to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true" />
          <source name="System.ServiceModel" switchValue="All">
              <add name="log" initializeData="D:\sitedata\Traces\MotionTraces.svclog" type="System.Diagnostics.XmlWriterTraceListener" traceOutputOptions="Timestamp">
                <filter type="" />
        <trace autoflush="true" />

    Client Side Code

            var Inst = new InstanceContext(this);
                    var b = new NetTcpBinding();

                    // Temp - for debugging only
                    b.SendTimeout = new TimeSpan(1, 59, 59);
                    b.ReceiveTimeout = new TimeSpan(1, 59, 59);
                    b.ReliableSession.Enabled = true;
                    b.ReliableSession.InactivityTimeout = new TimeSpan(1, 59, 59);
                    b.Security.Mode = SecurityMode.None;

                    var cf = new DuplexChannelFactory<IHelloservice>(Inst, b);
                    var MCAddr = new EndpointAddress("net.tcp://localhost:8456/Hello/Helloservice");
                    mService = cf.CreateChannel(MCAddr);

    for(int i=0;i<=5000;i++)


                    Task.Run(() => HelloServiceProxy.Instance.Service.GetData(out var info));


    Please suggest a solution for this????

    i have added the throtlling behaviour then its started working.Is this is the correct solution?

                    <behavior name="">
                        <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
                        <serviceDebug includeExceptionDetailInFaults="false" />
                        <serviceThrottling maxConcurrentCalls="10000"

                                           maxConcurrentInstances ="10000"

                                           maxConcurrentSessions ="10000"/>


    Tuesday, April 2, 2019 12:18 PM

All replies