我有一個塞納里奧在那裏我有使用WCF服務,我是能夠成功地做,如果上載內容的大小小於1MB,但如果上載內容的大小大於1MB,蔭得到這樣的錯誤上傳一些DATASWCF綁定中的最大緩衝區大小是多少?
錯誤消息: - 在接收到 HTTP響應
發生錯誤的 「http://本地主機/ ABC /管理/服務/包」。由於服務端點綁定不使用HTTP協議,因此這可能是 。這個 也可能是由於HTTP請求上下文被服務器中止(可能是由於服務關閉)。有關更多詳細信息,請參閱服務器日誌 。
我認爲它的一個錯誤是關於我的緩衝區大小設置在我的綁定app.config。
我的app.config文件客戶端設置如下所示。
<system.serviceModel>
<client>
<endpoint address="http://localhost/abc/Services/Package"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_PackageService"
contract="PackageService.PackageService" name="BasicHttpBinding_PackageService" />
</client>
<services>
<!-- This section is optional with the new configuration model
introduced in .NET Framework 4. -->
<service name="ServiceContracts.SearchServiceContract"
behaviorConfiguration="SearchServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/xyz/SearchService"/>
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: http://localhost:8080/xyz/SearchService -->
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="NoSecurityBinding"
contract="ServiceContracts.ISearchServiceContract" />
<!-- the mex endpoint is exposed at http://localhost:8080/xyz/SearchService/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<service name="ServiceContracts.PackageServiceContract"
behaviorConfiguration="PackageServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/xyz/PackageService"/>
</baseAddresses>
</host>
<!-- this endpoint is exposed at the base address provided by host: http://localhost:8080/xyz/PackageService -->
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="NoSecurityBinding"
contract="ServiceContracts.IPackageServiceContract" />
<!-- the mex endpoint is exposed at http://localhost:8080/xyz/PackageService/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SearchServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
<behavior name="PackageServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_PackageService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="268435456" maxBufferPoolSize="268435456" maxReceivedMessageSize="268435456"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="268435456" maxNameTableCharCount="268435456" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="NoSecurityBinding">
<security mode="None">
<transport clientCredentialType="None" />
<message establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
有誰可以知道這個請求的解決方法嗎?我的上傳大小可以達到2GB大小。那麼,我必須給出的確切buffersize或maxReceivedMessageSize或maxStringContentLength是什麼?