2
我試圖從MSDN this example。WCF錯誤MTOM編碼+從客戶端發送大量數據到服務
我嘗試使用FileStream和WCF發送文件。
當我發送只有幾個字節的小文件時,我得到輸出。但是,當我試圖跨越幾MB的文件發送我得到一個錯誤:
System.ServiceModel.CommunicationException: An error (The request was aborted: The request was cancelled).
我都內的結合改變的最高值並將其設置爲更大的價值。我也改變了超時時間。我啓用了跟蹤功能,但在跟蹤中找不到任何錯誤。
我無法弄清楚這個問題。誰能幫忙?
這裏的服務..配置文件
<behaviors>
<serviceBehaviors>
<behavior name="wsHttpServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="customWsHttpBinding" messageEncoding="Mtom"
openTimeout="00:10:00" maxReceivedMessageSize="2147483647"
closeTimeout="00:10:00"
receiveTimeout="00:10:00"
sendTimeout="00:10:00">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxNameTableCharCount="16384"/>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="MTOMUploadService.UploadService" behaviorConfiguration="wsHttpServiceBehavior">
<endpoint address="mex" contract="IMetadataExchange" binding="wsHttpBinding"/>
<endpoint contract="MTOMUploadService.IUploadService" binding="wsHttpBinding" bindingConfiguration="customWsHttpBinding" />
</service>
</services>
這裏是客戶端配置....
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IUploadService" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://machinename:4575/MTOMUploadService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IUploadService"
contract="IUploadService" name="WSHttpBinding_IUploadService">
<identity>
<servicePrincipalName value="machinename" />
</identity>
</endpoint>
</client>
</system.serviceModel>
您是否更改了客戶端和服務綁定的消息大小? – Chris
你可以與我們分享綁定配置嗎? – Jeroen
@Jeroen我已經添加了配置信息..謝謝 – Sandepku