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:
[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:
[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):
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, "");
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?