通过WCF回调发送业务对象时发生超时 [英] Timeout occuring when sending business object through WCF Callback

查看:161
本文介绍了通过WCF回调发送业务对象时发生超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务实现了一个回调合同,我试图发送一个业务对象通过。我有用DataContract()和DataMember()属性装饰的业务对象,它包含以下数量的属性:




  • ints:3

  • 字符串:4

  • XElement:1

  • 和DataMember()



每当我尝试通过回调发送这个对象时,服务超时。通过回调发送的属性较少,如果只有一个属性,则可以获得它,但如果我有多个属性,则服务超时。



我的配置有什么问题我已经尝试了默认的wsDualHttpBinding,以及一个customBinding(如下所示),我已经尝试过各种不同的设置与maxBufferSize,maxBufferPoolSize和maxReceivedMessageSize。我不想增加超时,因为我希望这个对象能够相当快地到达我的客户端。请有人帮助我...如果我有任何头发离开我现在会把它拉出来!!!!!



我已经配置我的服务: / p>

服务器配置:

 < customBinding> 
< binding name =DualBindingConfig>
< reliableSession flowControlEnabled =truemaxPendingChannels =128/>
< compositeDuplex />
< oneWay />
< binaryMessageEncoding />
< httpTransport maxReceivedMessageSize =655360000maxBufferPoolSize =655360000/>
< / binding>
< / customBinding>
< services>
< service behaviorConfiguration =Agent_Utility_WCF.Callback.AgentMessagingBehavior
name =Agent_Utility_WCF.Callback.AgentMessaging>
< endpoint address =binding =customBindingbindingConfiguration =DualBindingConfigbindingName =AgentMessagingcontract =Agent_Utility_WCF.Callback.IAgentMessaging>
< identity>
< dns value =localhost/>
< / identity>
< / endpoint>
< endpoint address =mexbinding =mexHttpBindingcontract =IMetadataExchange/>
< / service>
< / services>
< behaviors>
< serviceBehaviors>
< behavior name =Agent_Utility_WCF.Callback.AgentMessagingBehavior>
< serviceMetadata httpGetEnabled =true/>
< serviceDebug includeExceptionDetailInFaults =true/>
< serviceThrottling maxConcurrentCalls =160maxConcurrentSessions =100/>
< / behavior>
< / serviceBehaviors>
< / behaviors>

客户端配置:

 < bindings> 
< customBinding>
< binding name =AgentMessaging_IAgentMessaging>
< reliableSession acknowledgementInterval =00:00:00.2000000flowControlEnabled =true
inactivityTimeout =00:10:00maxPendingChannels =4maxRetryCount =8
maxTransferWindowSize = 8ordered =trueiableMessagingVersion =Default/>
< compositeDuplex />
< oneWay maxAcceptedChannels =10packetRoutable =false>
< channelPoolSettings idleTimeout =00:02:00leaseTimeout =00:10:00
maxOutboundChannelsPerEndpoint =10/>
< / oneWay>
< binaryMessageEncoding maxReadPoolSize =64maxWritePoolSize =16
maxSessionSize =2048>
< readerQuotas maxDepth =32maxStringContentLength =8192maxArrayLength =16384
maxBytesPerRead =4096maxNameTableCharCount =16384/>
< / binaryMessageEncoding>
< httpTransport manualAddressing =falsemaxBufferPoolSize =524288
maxReceivedMessageSize =65536allowCookies =falseauthenticationScheme =Anonymous
bypassProxyOnLocal =falsehostNameComparisonMode =StrongWildcard
keepAliveEnabled =truemaxBufferSize =65536proxyAuthenticationScheme =Anonymous
realm =transferMode =BufferedunsafeConnectionNtlmAuthentication =false
useDefaultWebProxy =true/&
< / binding>
< / customBinding>
< / bindings>
< client>
< endpoint address =http:// localhost:666 / Callback / AgentMessaging.svc
binding =customBindingbindingConfiguration =AgentMessaging_IAgentMessaging
contract =AgentMessaging.IAgentMessaging =AgentMessaging_IAgentMessaging>
< identity>
< dns value =localhost/>
< / identity>
< / endpoint>
< / client>


解决方案

将以下内容添加到您的web.config中:

 < system.diagnostics> 
< trace autoflush =true>
< listeners>
< / listeners>
< / trace>
< sources> ;,
< source name =System.ServiceModel
switchValue =Information,ActivityTracing
propagateActivity =true>
< listeners>
< add name =sdt
type =System.Diagnostics.XmlWriterTraceListener
initializeData =WcfDetailTrace.svclog/>
< / listeners>
< / source>
< / sources>
< /system.diagnostics>

然后调用您的Web服务方法。这将在您的网站的根目录中生成 WcfDetailTrace.svclog 。使用 SvcTraceViewer.exe 打开此文件。这应该给你几乎所有的信息。


I have a WCF service implemented with a call back contract that I am trying to send a business object through. I have the business object decorated with DataContract() and DataMember() attributes, and it contains the following number of properties:

  • ints: 3
  • strings: 4
  • XElement: 1
  • other objects: 5 (also decorated with DataContract() and DataMember()

Whenever I try and send this object over the callback, the service times-out. I have tried creating other objects with fewer properties to send through the callback, and can get it to go through if there is only one property, but if I have any more than one property, the service times out.

Is there something wrong in my configuration? I have tried the default wsDualHttpBinding, as well as a customBinding (as displayed below) and I have tried all sorts of different settings with the maxBufferSize, maxBufferPoolSize, and maxReceivedMessageSize. I don't want to increase the timeout, as I would like this object to arrive to my client fairly quickly. Please somebody help me...if I had any hair left I would have pulled it out by now!!!!!

I have configured my service as such:

Server Configuration:

    <customBinding>
        <binding name="DualBindingConfig">
            <reliableSession flowControlEnabled="true" maxPendingChannels="128" />
            <compositeDuplex />
            <oneWay/>
            <binaryMessageEncoding/>
            <httpTransport maxReceivedMessageSize="655360000" maxBufferPoolSize="655360000" />
        </binding>
    </customBinding>
    <services>
        <service behaviorConfiguration="Agent_Utility_WCF.Callback.AgentMessagingBehavior"
            name="Agent_Utility_WCF.Callback.AgentMessaging">
            <endpoint address="" binding="customBinding" bindingConfiguration="DualBindingConfig" bindingName="AgentMessaging" contract="Agent_Utility_WCF.Callback.IAgentMessaging">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="Agent_Utility_WCF.Callback.AgentMessagingBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceThrottling maxConcurrentCalls="160" maxConcurrentSessions="100"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>

Client Configuration:

<bindings>
    <customBinding>
        <binding name="AgentMessaging_IAgentMessaging">
            <reliableSession acknowledgementInterval="00:00:00.2000000" flowControlEnabled="true"
                inactivityTimeout="00:10:00" maxPendingChannels="4" maxRetryCount="8"
                maxTransferWindowSize="8" ordered="true" reliableMessagingVersion="Default" />
            <compositeDuplex />
            <oneWay maxAcceptedChannels="10" packetRoutable="false">
                <channelPoolSettings idleTimeout="00:02:00" leaseTimeout="00:10:00"
                    maxOutboundChannelsPerEndpoint="10" />
            </oneWay>
            <binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                maxSessionSize="2048">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            </binaryMessageEncoding>
            <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
                maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
                realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                useDefaultWebProxy="true" />
        </binding>
    </customBinding>
</bindings>
<client>
    <endpoint address="http://localhost:666/Callback/AgentMessaging.svc"
        binding="customBinding" bindingConfiguration="AgentMessaging_IAgentMessaging"
        contract="AgentMessaging.IAgentMessaging" name="AgentMessaging_IAgentMessaging">
        <identity>
            <dns value="localhost" />
        </identity>
    </endpoint>
</client>

解决方案

Add the following to your web.config:

<system.diagnostics>
    <trace autoflush="true">
        <listeners>
        </listeners>
    </trace>
    <sources>
        <source name="System.ServiceModel"
                switchValue="Information, ActivityTracing"
                propagateActivity="true">
            <listeners>
                <add name="sdt"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData= "WcfDetailTrace.svclog" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>

Then invoke your web service method. This will generate WcfDetailTrace.svclog in the root of your web site. Open this file with SvcTraceViewer.exe. This should give you pretty much information on what's going on.

这篇关于通过WCF回调发送业务对象时发生超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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