So I created Client/Server WCF. What I want is when I send message to the server from this client and the connection cuts for any reason , client shuts down for example, how could this client get the response when it is availabe again ?
Is it possible to set a session or something like between the client and the server?
My client code is :
private static void Main(string[] args)
{
var client = new FlipCaseServiceClient("ReliableMessageService");
var sd = new StringData { FirstName = "Turgut", LastName = "Kançeltik" };
var fullName = client.GetFullName(ref sd);
Console.WriteLine(fullName);
}
My Server code is :
[DeliveryRequirements(RequireOrderedDelivery = true)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]
public class FlipCaseService : IFlipCaseService
{
public string GetFullName(ref StringData stringData)
{
var fullName = $"{stringData.FirstName} {stringData.LastName}";
stringData.FullName = fullName;
return fullName;
}
}
And server configurations in summary :
<service behaviorConfiguration="ServiceBehaviorMetaData" name="FlipCaseService.FlipCaseService" >
<endpoint name="ReliableMessageService" address="flipcase/wsAddress" binding="wsHttpBinding" bindingConfiguration="BindingReliableMessaging" contract="FlipCaseService.IFlipCaseService" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
<bindings>
<wsHttpBinding>
<binding name="BindingReliableMessaging">
<reliableSession enabled="true" inactivityTimeout="00:10:00"/>
</binding>
</wsHttpBinding>
</bindings>
<behavior name="ServiceBehaviorMetaData">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8080/flipcase/metadata" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>