wcf 最大消息大小

标签 wcf size service message max

我有两个服务,并且在它们之间发送相当大的消息(~100kb)。尽管前面提到的值是消息大小的典型值,但它可能会大幅波动(正向和负向)。
因此,为了处理我必须传输膨胀消息的这种情况,我已经在客户端和服务器端的 app.config 中设置了所有最大消息大小、最大字符串大小等属性(相关端点正确引用了绑定(bind)其中说明了尺寸)。
为了安全起见,我输入的界限完全超过了任何可能的消息大小。然而,在消息大小尺度的低端,服务间通信已被证明是可靠的,而在高端,情况并非如此——消息似乎根本没有被传递。
最奇怪的是,如果消息超过了最大大小,则会抛出异常(我已经遇到了足够多的这些,知道这一点!哈哈),但什么都没有抛出——这一切都完全无声无息地过去了。我已经尝试过各种大小的消息,并且它肯定只是随着消息大小的增长才开始发生。我可以证明目标服务没有接收到,因为在接收时,该服务会在数据库中记录日志 - 但是对于大消息,不会生成日志。
正如我所说,我几乎可以肯定我已经增加了 app.config 中所有适用属性的大小,所以我对这种行为完全感到困惑!
关于什么可能导致这种神秘行为的任何建议?

最佳答案

好吧,这个问题似乎已经解决了(突然间,在以前从未提示过之后,WCF 开始对 app.config 中的某个值感到不安,改变了它,然后它似乎工作了!)

但是现在我有一个同样奇怪的问题!出于某种原因,它拒绝接受我已配置要发布的元数据。我的 app.config(主机端)设置如下:

<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>

我已经尽力弄清楚为什么它会声称元数据没有在指定的地址“http://localhost:8010/Feeder/mex”上发布。任何帮助都是 大大赞赏。

干杯!

关于wcf 最大消息大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/369132/

相关文章:

c# - 让 IIS 托管 WCF 服务中的流式传输正常工作

asp.net - 云上的 HTTPS WCF Web 服务

Oracle NUMBER(p) 存储大小?

android - 结合服务处理暂停或停止的 Activity

c# - Windows 服务可以在未登录的情况下启动应用程序吗?

java - 防止停止android服务

wcf - 将 xml 数据发送到 WCF REST 服务

.net - 我可以使用 UriTemplate 将非字符串传递给 WCF RESTful 服务吗?

html - 我的图像没有改变大小

java - Hibernate - OutOfMemoryError - java 堆大小