【发布时间】:2009-07-07 12:56:53
【问题描述】:
我有一个使用回调合同实现的 WCF 服务,我试图通过该合同发送业务对象。我有用 DataContract() 和 DataMember() 属性装饰的业务对象,它包含以下数量的属性:
- 整数:3
- 字符串:4
- X 元素: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>
客户端配置:
<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>
【问题讨论】: