我有几个关于WCF可靠会话可靠性的问题:
WCF是否在重试尝试期间重新序列化消息?
2.如果1是正确的 - 消息参数处理后是否发生?
3.如果2是正确的 - 是否有任何方法可以确定是否已发送消息?
我还想通过反射器来解决这个问题.
UPD 1:我对服务器返回值更感兴趣.他们会怎么样?
UPD 2:何时处理消息参数(准确地说 - 服务器回复)?收到适当的ack时会发生吗?这是我处理参数的意思:
at MyNamespace.MyReply.Dispose()
at System.ServiceModel.Dispatcher.MessageRpc.DisposeParametersCore()
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessageCleanup(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)
at System.ServiceModel.Channels.InputQueue`1.AsyncQueueReader.Set(Item item)
at System.ServiceModel.Channels.InputQueue`1.Dispatch()
at System.ServiceModel.Channels.InputQueueChannel`1.Dispatch()
at System.ServiceModel.Channels.ReliableReplySessionChannel.ProcessSequencedMessage(RequestContext context, String action, WsrmSequencedMessageInfo info)
...stack continues
Run Code Online (Sandbox Code Playgroud)
我需要使用它来处理服务器回复(我有另一个SOF线程,为什么我来到这个解决方案).
UPD 3:我试图解决的问题是,我的服务器回复 …
所以我创建了Client/Server WCF.我想要的是当我从这个客户端向服务器发送消息并且因任何原因切断连接时,客户端关闭,例如,当客户端再次可用时,该客户端如何获得响应?
是否可以在客户端和服务器之间设置会话等?
我的客户代码是:
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);
}
Run Code Online (Sandbox Code Playgroud)
我的服务器代码是:
[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;
}
}
Run Code Online (Sandbox Code Playgroud)
和服务器配置摘要:
<service behaviorConfiguration="ServiceBehaviorMetaData" name="FlipCaseService.FlipCaseService" >
<endpoint name="ReliableMessageService" address="flipcase/wsAddress" binding="wsHttpBinding" bindingConfiguration="BindingReliableMessaging" contract="FlipCaseService.IFlipCaseService" …Run Code Online (Sandbox Code Playgroud) 在WSHttpBinding启用了reliableSessions的WCF中使用时,我的服务引用会将自身更新为:
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="true">
</reliableSession>
Run Code Online (Sandbox Code Playgroud)
maxRetryCount只要将绑定配置为WSHttpBinding,我就无法将该属性添加到reliableSession.
现在我的问题是:maxRetryCount使用WSHttpBinding时的价值是什么,有没有办法在配置中改变它; 不使用CustomBinding?