使用WCF上傳50MG文件的最佳方式是什麼?WCF使用MTOM上傳50Mg文件
我認爲MTOM會自動處理。
我想我錯了......
發生異常,甚至在本地主機
(我使用的是外部IIS甚至會最壞的假設)運行。
異常消息:在接收到 http://localhost:7064/DataSyncService.svc HTTP響應
「發生錯誤這可能是由於 服務端點不使用HTTP協議綁定這也 可能是由於一個。 HTTP請求上下文被服務器 中止(可能由於服務關閉)。有關更多 詳細信息,請參閱服務器日誌。
服務器配置:
<system.serviceModel>
<client>
<remove contract="IMetadataExchange" name="sb" />
</client>
<bindings>
<wsHttpBinding>
<binding name="DataSyncBinding" messageEncoding="Mtom" maxReceivedMessageSize ="50000000" maxBufferPoolSize="50000000">
<readerQuotas maxArrayLength="50000000" />
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Server.DataSyncServiceBehavior" name="Server.DataSyncService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="DataSyncBinding" name="DataSyncService"
contract="Server.IDataSyncService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Server.DataSyncServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />
</system.serviceModel>
客戶端配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="DataSyncService" closeTimeout="00:05:00" openTimeout="00:05:00"
receiveTimeout="00:30:00" sendTimeout="00:30:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:7064/DataSyncService.svc"
binding="wsHttpBinding" bindingConfiguration="DataSyncService"
contract="DataSyncServiceReference.IDataSyncService" name="DataSyncService" />
</client>
</system.serviceModel>
在先進的感謝。
50毫克?這是一個非常小的文件... – 2012-03-05 23:02:48
另一方面,50兆千兆比較大。無論單位。 – 2012-03-05 23:53:49