Reputation: 12213
I have defined OneWay attribute on some of the methods of my service but they are not behaving like its a Oneway call. My Client waits for the call to complete and return from the service. I am assuming that Oneway operations are non-blocking operations and client doesnt care what happens to the called function. It just calls and forgets abt it. Is it correct?
Problem: After calling OperationContract2, I immediately close the proxy but my client waits for the exection to complete.
if (((ICommunicationObject)myServices).State == CommunicationState.Opened)
{
((ICommunicationObject)myServices).Close();
}
Is there something wrong with the configs?
Server Config:
<netTcpBinding>
<binding name="GoCustomBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="0" maxReceivedMessageSize="2147483647">
</binding>
</netTcpBinding>
Service Contract:
[ServiceContract]
public interface IMyServices
{
[OperationContract(IsOneWay = true, Action = "*")]
void OPeration1(List<int> someIds);
[OperationContract(IsOneWay = true)]
void OPeration2(SomeClass p1);
}
Client Proxy:
[ServiceContract]
public interface IMyServices
{
[OperationContract(IsOneWay = true, Action = "*")]
void Operation1(List<int> someIds);
[OperationContract(IsOneWay = true)]
void Operation2(SomeClass p1);
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class ServiceClient : ClientBase<IMyServices>, IMyServices
{
public void ScheduleOptimization(List<int> someIds)
{
Channel.Operation1(routeID);
}
public void Operation1(SomeClass p1)
{
Channel.Operation2(pasDataMsg);
}
}
Upvotes: 3
Views: 3407
Reputation: 15559
From the documentation for that attribute:
Specifying that an operation is a one-way operation means only that there is no response message. It is possible to block if a connection cannot be made, or the outbound message is very large, or if the service cannot read inbound information fast enough. If a client requires a non-blocking call, generate AsyncPattern operations. For more information, see One-Way Services and Consuming Services Using a Client.
Could any of those be your problem?
Upvotes: 7