Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is a service based on TCP binding. Uses a duplex channel for feedback from the client side. Periodically, the connection status WAIT CLOSE then the entire service becomes available. Then become part of the service is not available on port 80.
Service simply not be available until there is a connection WAIT CLOSE. At this point, the server connected clients ~ 4500-5500.

Interface:
C#
  [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IMyServiceCallback))]
 public interface IMyService
 {
     [OperationContract(IsInitiating = true, IsOneWay = true, IsTerminating = false)]
     void Add(int id, string version);

     [OperationContract(IsInitiating = true, IsOneWay = true, IsTerminating = true)]
     void Remove(int id);

     [OperationContract(IsInitiating = true, IsOneWay = false, IsTerminating = false)]
     bool Check(int id, string version);
}


The service implementation settings:
C#
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
   public class MyService : IMyService, IDisposable
   {
      ...
   }


Set binding and host programmatically(Tried to remove the restriction using ServiceThrottlingBehavior):
C#
var host = new ServiceHost(typeof(MyService), new Uri(EndPointAddress));

              var binding = new NetTcpBinding
              {
                  Security = { Mode = SecurityMode.None },
                  TransferMode = TransferMode.Buffered,
                  ReliableSession = { Ordered = false, InactivityTimeout = new TimeSpan(1, 10, 0)},
                  CloseTimeout = new TimeSpan(0, 0, 20),
                  OpenTimeout = new TimeSpan(0, 1, 0),
                  ReceiveTimeout = new TimeSpan(0, 30, 5),
                  SendTimeout = new TimeSpan(0, 1, 10),
                  MaxBufferPoolSize = int.MaxValue,
                  MaxBufferSize = int.MaxValue,
                  MaxReceivedMessageSize = int.MaxValue,
                  MaxConnections = int.MaxValue,

                  ReaderQuotas =
                  {
                      MaxBytesPerRead = int.MaxValue,
                      MaxDepth = int.MaxValue,
                      MaxNameTableCharCount = int.MaxValue,
                      MaxStringContentLength = int.MaxValue,
                      MaxArrayLength = int.MaxValue
                  }
              };

              host.AddServiceEndpoint(typeof(IMyService), binding, "");
              //MEX
              var smb = new ServiceMetadataBehavior
              {
                  HttpGetEnabled = true,
                  HttpGetUrl = new Uri(EndPointAddressMex)
              };
              host.Description.Behaviors.Add(smb);
              var throttlingBehavior = new ServiceThrottlingBehavior
              {
                  MaxConcurrentCalls = 100000,
                  MaxConcurrentInstances = Int32.MaxValue,
                  MaxConcurrentSessions = 100000
              };
              host.Description.Behaviors.Add(throttlingBehavior);


What could be the reason? What can be done? Why TCP service may not be available?
Posted
Updated 11-Apr-14 4:08am
v2
Comments
[no name] 11-Apr-14 7:47am    
Are you running a web server? Web servers typically use port 80 so you might try changing your service to using an unused port.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900