每當我連我的客戶端將數據發送到我的WCF Azure的服務,我得到這個錯誤:maxReceivedMessageSize在Azure WCF服務太小
「的最大郵件大小配額傳入消息(65536)已超出。要增加配額 ,請在適當的綁定 元素上使用MaxReceivedMessageSize屬性。「
我讀過無處不在關於在客戶端和服務器配置文件上設置MaxReceivedMessageSize屬性。我已經做到了。
但是,每當我更新客戶端服務引用,它拉的設置恢復到65536默認(通過調查.svcinfo文件中)
這使我得出結論的問題,必須在服務方面。
我放在這在我的web.config文件:
<bindings>
<basicHttpBinding>
<!--The basicHttpBinding is used for clients which use the generated code to transmit data; the following settings make it possible to send larger amounts to the service-->
<binding maxReceivedMessageSize="10000000" receiveTimeout="01:00:00">
<readerQuotas maxStringContentLength="10000000" />
</binding>
</basicHttpBinding>
</bindings>
現在,很多帖子談論命名綁定並在服務器端設置它在服務端點爲好。這樣的事情:
<services>
<service name="YourNamespace.YourServiceClass">
<endpoint name="endpoint1"
address="http://server:8888/YourService.svc"
binding="basicHttpBinding"
bindingConfiguration="lageMessageTransfer"
contract="IYourServiceContract" />
</service>
</services>
但是,我沒有這些服務端點,我的服務很適合小尺寸。
這需要設置在哪裏?
編輯:
更多信息,蒂姆似乎是在正確的軌道與默認端點上。我正在使用默認端點。看起來你不能明確地爲該默認端點定義一個服務。或者如果可以的話,我必須做的不正確。
但是,您似乎可以按照Richard的說法修改默認端點上的綁定。這是通過簡單地不指定綁定的名稱來完成的。我嘗試將服務中的值設置爲更低的值,以查看是否有其他值正在降低它們,但它們完全被忽略。它就好像默認端點簡單地忽略了我創建的綁定。
在我的整個配置文件:爲什麼沒有被拾起新的綁定設置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="sdt" type="System.Diagnostics.XmlWriterTraceListener" initializeData="logging.e2e" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="100" maxBufferSize="100" receiveTimeout="00:11:00">
<readerQuotas maxStringContentLength="100" />
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add scheme="http" binding="basicHttpBinding" />
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings><EDITEDOUT></connectionStrings>
</configuration>
的思考?
不幸的是,據我所知,如果你不能修改服務的配置,就會陷入困境。如果您絕對無法修改服務的配置,則需要採取措施確保您的有效負載小於65536字節的最大值。 – GunnerL3510 2011-06-17 01:54:04
我可以修改服務器的配置,但是它不會選擇新的設置。 – Jared 2011-06-17 22:50:54