1
想要使用WCF將數據庫中的文件保存爲二進制數據。客戶端是ASP.NET C#。我已經使用下面的代碼,並能夠發送少於100KB。發送大量數據使用WCF與客戶端ASP.NET
客戶端配置文件的代碼是
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
textEncoding="utf-8" transferMode="StreamedResponse" useDefaultWebProxy="true"
messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="">
<extendedProtectionPolicy policyEnforcement="Never" />
</transport>
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IWITSService" />
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="debuggingBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:4175/WITSWCFService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWITSService"
contract="MyService.IWITSService" name="BasicHttpBinding_IWITSService" />
</client>
</system.serviceModel>
及以下
<system.web>
<compilation debug="true" />
<httpRuntime executionTimeout="4800" maxRequestLength="2147483647" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpEndpointBinding" closeTimeout="01:01:00"
openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="StreamedRequest"
useDefaultWebProxy="true">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WITSService.WITSService" >
<endpoint bindingConfiguration="basicHttpEndpointBinding" address="basic" binding="basicHttpBinding" contract="WITSService.WITSService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="myEndPointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
服務配置文件的代碼被給予當我上傳300kb的文件我得到這個錯誤
遠程服務器返回了意外的迴應:(413)請求 實體太大
任何一個可以幫助我在哪裏出錯了.. 由於提前
http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize –
爵士的可能重複我已經檢查這個線程。但這對我沒有幫助。我附上了我的配置文件的代碼。請告訴我我犯了什麼錯誤.. – MindFresher