2

我有两个服务,并且在它们之间发送相当大的消息(~100kb)。尽管前面提到的值是消息大小的典型值,但它可能会大幅波动(正向和负向)。

因此,为了处理我必须传输膨胀消息的这种情况,我已经在客户端和服务器端的 app.config 中设置了所有最大消息大小、最大字符串大小等属性(相关端点正确引用了绑定其中说明了尺寸)。

为了安全起见,我输入的界限完全超过了任何可能的消息大小。然而,在消息大小尺度的低端,服务间通信已被证明是可靠的,但在高端,情况并非如此——消息似乎根本没有被传递。

最奇怪的是,如果消息超过了最大大小,则会抛出异常(我已经遇到了足够多的这些,知道这一点!大声笑),但什么都没有抛出——这一切都完全无声无息地过去了。我已经尝试过各种大小的消息,并且它肯定只是随着消息大小的增长才开始发生。我可以证明目标服务没有接收到,因为在接收到后,该服务会在数据库中记录日志 - 但是对于大消息,不会生成日志。

正如我所说,我几乎可以肯定我已经增加了 app.config 中所有适用属性的大小,所以我对这种行为完全感到困惑!

关于什么可能导致这种神秘行为的任何建议?

4

3 回答 3

1

well this problem seems to have resolved itself (suddenly after never complaining before, WCF started getting upset about a certain value in the app.config, changed that and it seemed to work then!)

however now i have an equally strange problem! for somre reason it refuses to accept that i have configured metadata to be published. my app.config (host side) set up is as follows:

<services>
  <service name="DataFeederService.FeederService" behaviorConfiguration="DataFeederService.FeederServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8010/Feeder"/>
        <add baseAddress="net.pipe://localhost/FeederPipe"/>
      </baseAddresses>
    </host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint name="namedPipeEndpoint" 
    address=""  
    bindingConfiguration="IPCWindowsSecurity" 
    binding="netNamedPipeBinding" 
    contract="DataFeederService.IFeederService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>

    <endpoint name="httpEndpoint" 
    address="FeederService" 
    binding="wsHttpBinding" 
    bindingConfiguration="httpBinding" 
    contract="DataFeederService.IWebFeederService"/>

    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>

<bindings>
  <netNamedPipeBinding>
    <binding name="IPCWindowsSecurity" 
    maxBufferPoolSize="965536" 
    maxBufferSize="965536" 
    maxReceivedMessageSize="965536">
      <readerQuotas maxStringContentLength="965536" />
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign" />
      </security>
    </binding>
  </netNamedPipeBinding>
  <wsHttpBinding>
    <binding name="httpBinding" 
    maxBufferPoolSize="965536"
    maxReceivedMessageSize="965536">
      <readerQuotas maxStringContentLength="965536" />
    </binding>
  </wsHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="DataFeederService.FeederServiceBehavior">
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy15"/>
      <!-- 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" httpHelpPageEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

I have tried my best to work out why it would be claiming the metadata isn't being published at the specified address "http://localhost:8010/Feeder/mex". any help would be greatly appreciated.

Cheers!

于 2008-12-17T10:25:49.097 回答
1

对不起,经过进一步的拖网,我发现了错误的根源!datacontract 中的一个类已更改([DataContract] 属性已被删除,但奇怪的是 [DataMemeber] 已留在相关属性上!非常奇怪!)

无论如何,感谢您的所有帮助,尤其是 rfor 让我走到了这一步,我终于可以摆脱这个该死的项目了 :-)

于 2008-12-17T11:17:14.453 回答
0

WCF 偶尔会出现一些问题,这些问题会导致它“静默”失败(即没有例外),这可能很难调试。听起来这可能就是您所看到的情况。

在这种情况下,启用 WCF 中的跟踪选项非常有用,因为它应该允许您查看消息是否确实到达了服务以及调度程序如何处理它。

于 2008-12-16T12:46:29.127 回答