2014-11-14 118 views
2

我有一個wcf REST服務的web.config文件的最近更改,我剛剛爲其添加maxBufferSize="10485760"屬性。請在下面找到以下代碼段:配置錯誤:無法識別的屬性'maxBufferSize'

<wsHttpBinding> 
    <binding name="WSHttpBinding_IService" closeTimeout="00:04:00" 
       openTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:04:00" 
       bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode= 
       "StrongWildcard" maxBufferSize="10485760" maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" 
       useDefaultWebProxy="true" allowCookies="false"> 
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
       maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
       maxNameTableCharCount="2147483647" /> 
    <reliableSession ordered="true" inactivityTimeout="00:04:00" enabled="false" /> 
</binding> 
</wsHttpBinding> 

做出該更改後,應用程序不工作,拋出以下異常。

配置錯誤描述:處理服務此請求所需的配置文件時發生錯誤。 請查看下面的具體錯誤細節,並適當修改您的 配置文件。解析器錯誤消息:無法識別 屬性'maxBufferSize'。請注意屬性名稱是 區分大小寫。

如果任何人都可以提供幫助,那就太好了。

回答

6

整體你的問題是,wsHttpBinding綁定沒有任何maxBufferSize屬性。例如,該屬性在basicHttpBinding中可用。我建議您使用Visual Studio來修改web.config文件中的綁定,而不是直接修改它。另外你可以看到下次可用的屬性。 ScreenShot

wsHttpBinding具有屬性MaxBufferPoolSize,它與MaxBufferSize稍有不同。請撥打look at this post瞭解區別

相關問題