通过WCF回调发送业务对象时发生超时

Nic*_*ayo 4 .net c# wcf callback

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

  • 整理:3
  • 字符串:4
  • XElement:1
  • 其他对象:5(也用DataContract()和DataMember()修饰

每当我尝试通过回调发送此对象时,服务超时.我已经尝试创建具有较少属性的其他对象以通过回调发送,并且如果只有一个属性可以让它通过,但如果我有任何多个属性,则服务超时.

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

我已经配置了我的服务:

服务器配置:

    <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>
Run Code Online (Sandbox Code Playgroud)

客户端配置:

<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>
Run Code Online (Sandbox Code Playgroud)

Dar*_*rov 5

将以下内容添加到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>
Run Code Online (Sandbox Code Playgroud)

然后调用您的Web服务方法.这将在您的网站的根目录中生成WcfDetailTrace.svclog.使用SvcTraceViewer.exe打开此文件.这应该可以为您提供有关正在发生的事情的大量信息.