WCF:具有单向回调麻烦 [英] WCF: Having trouble with one-way callbacks

查看:156
本文介绍了WCF:具有单向回调麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直从WCF服务时获得单向回调调用这个令人费解的错误一个WPF客户端。

I keep getting this puzzling error upon invocation of a one-way callback to a WPF client from a WCF service.

该邮件无法传递
  所分配的超时时间内
  00:01:00。没有可用空间
  在可靠的信道的传输
  窗口。分配给该时间
  操作可能是一个部分
  更长的超时。

The message could not be transferred within the allotted timeout of 00:01:00. There was no space available in the reliable channel's transfer window. The time allotted to this operation may have been a portion of a longer timeout.

这是不发送数据太多,只是一个字符串只有一个单一的,在短字符串列表。

It isn't sending too much data, just a list of strings that only has one single, short string within.

我的服务器有如下配置:

My server has the following config:

<xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="RawDealService.GameService">
        <endpoint address ="" binding="wsDualHttpBinding" bindingConfiguration="basicConfig" contract="MyService.IGameService">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>
    <bindings>
      <wsDualHttpBinding>
        <binding name="basicConfig" messageEncoding="Text">
          <security mode="None"/>
        </binding>
      </wsDualHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

和我的客户有以下配置:

And my client has the following config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <wsDualHttpBinding>
                <binding name="WSDualHttpBinding_IGameService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00" />
                    <security mode="None">
                        <message clientCredentialType="Windows" negotiateServiceCredential="true" />
                    </security>
                </binding>
            </wsDualHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:44259/GameService.svc" binding="wsDualHttpBinding"
                bindingConfiguration="WSDualHttpBinding_IGameService" contract="IGameService"
                name="WSDualHttpBinding_IGameService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
  </startup>
</configuration>

它只是莫名其妙,这可能发生,因为该消息是相对小的,并且回调是单向的。我应该尝试一些不同的绑定?

Its just baffling that this could happen, given that the message is relatively small and the callback is only one-way. Should I try some different bindings?

推荐答案

我发现这个问题,它不幸的是,这个特殊的错误消息,派我来一个完全错误的道路。

I found the issue, and its unfortunate that this particular error message sent me down a completely wrong path.

我的DataContract设置了一些教学班,在继承它,我没有正确标记为 KnownType 秒。

My DataContract setup had some classes with inheritance in it, and I hadn't properly marked for KnownTypes.

我的猜测是,在某些时候客户端试图反序列化相关的对象和失败。该错误不能被正常的框架处理,或许它一直试图发送一遍又一遍,并获得一分钟后没有任何反应。

My guess is at some point the client tried to de-serialize an associated object and failed. The error must not have been handled gracefully by the framework, and perhaps it kept trying to send over and over, and got no response after a minute.

或许,如果我有一个双向通话我会得到更翔实的堆栈跟踪。

Perhaps if I had a two-way call I would have gotten a more informative stack trace.

这篇关于WCF:具有单向回调麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆