2009-11-10 77 views
7

我試圖調用WCF服務(在Windows服務,而不是IIS託管)和我得到以下錯誤:WCF的最大郵件大小配額

The maximum message size quota for incoming messages has been exceeded for the remote channel. See the server logs for more details.

我試圖增加MaxReceivedMessageSize和ReaderQuotas沒有任何運氣的最大值。

我也打開了日誌記錄並檢查了正在「發送」的消息大小。這絕對不是最接近的。我們正在討論發送一個序列化爲372KB XML的對象。

兩個問題:

  1. 有誰知道什麼是「服務器日誌」的消息是指什麼?我檢查了EventViewer,但沒有顯示那裏...

  2. 有沒有人知道其他配置設置可能適用於此?

回答

5

您的問題讓我想起了Shawn Wildermuth的博客文章,他在Silverlight應用程序中遇到大郵件大小問題。也許這會幫助你:

http://wildermuth.com/2009/09/10/Using_Large_Message_Requests_in_Silverlight_with_WCF

肖恩說:

The trick is to change the customBinding in the web.config to use larger defaults. I picked 2MB as it its a reasonable size. Of course setting them to 2GB like shown above will work but it does leave you more vulnerable to attacks. Pick a size that isn't larger than your largest request but isn't overly large. Its a guessing game. To set these, you need to add them to your web.config is to put them on the httpTransport node:

+0

謝謝!這篇文章真的很有幫助。 – manu08 2009-11-11 17:21:06

1

我認爲服務器日誌是指打開時創建的跟蹤和日誌記錄文件。這是MSDN link

我在WCF中遇到的需要在應用程序中具有較高值的​​屬性是maxReceivedMessageSize,maxStringContentLength,maxArrayLength和maxBufferSize。 試着增加它們,看看會發生什麼。 WCF可能很難調試,因爲它喜歡吞食異常。

1

可以按如下

<system.diagnostics> 
    <trace autoflush="true" /> 
    <sources> 
     <source name="System.ServiceModel" 

        switchValue="Critical, Error, Warning" 
       > 
     <listeners> 
      <add name="traceListener" 
         type="System.Diagnostics.XmlWriterTraceListener" 
         initializeData="F:\log-data\ServiceTrace.svclog" 
      /> 
     </listeners> 
     </source> 
    </sources> 

    </system.diagnostics> 
+1

我已經將此配置項添加到我的服務應用程序,並獲取日誌文件。但是,它只是顯示發送消息。它並沒有顯示任何有關實際錯誤或其他反例的信息。 – manu08 2009-11-10 19:27:25

0

兩件事指定應用程序配置的服務器日誌和路徑:

  • 你可以向我們展示服務器和客戶端配置(只是相關部分 - 端點,綁定配置)

  • 你是否改變了雙方(客戶端和服務器)的值?

有大小設置,您可以影響整個過多....

相關問題