[英]binding and configuration for webHttpBinding in RESTful service?
我是WCF的新手,正設法使我迷惑於服務所采用的配置迷宮。 我有一個rest服務,可以返回表的導出,該表比默認的maxReceivedMessageSize
。 因此,我一直在嘗試使用該服務/端點的配置,但是卻一無所獲。 在下面,如果我要研究的要點是什么,我想念的是什么? 我只是將List返回為JSON或XML,並且我需要能夠返回默認閾值。
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<!-- defin service -->
<service behaviorConfiguration="EPRestBehavior" name="EPRestDNS">
<endpoint address=""
bindingConfiguration="ApiExportBinding"
binding="webHttpBinding"
contract="IDNSRestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EPRestBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
...
</behaviors>
<bindings>
<!-- Customizations for REST service -->
<webHttpBinding>
<binding name="ApiExportBinding" maxReceivedMessageSize="10485760"
maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxDepth="32" maxStringContentLength="10485760"
maxArrayLength="10485760" maxBytesPerRead="10485760" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
更新1我已經刪除了所有配置,並嘗試使用現有的webHttpEndpoint部分進行簡化操作:
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="1000000000" />
</webHttpEndpoint>
</standardEndpoints>
具有相同的結果。 HTTP/1.1 502 Connection reset by peer
這就是為什么WCF可怕的原因。 最后,我在服務器上創建了一個svclog,實際問題是達到默認對象圖中的限制。 我在實現中添加了我想要的新限制,僅此而已。 像這樣愚蠢的事情需要7個多小時。
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, MaxItemsInObjectGraph = 2147483646)]
服務或客戶端是否會發生異常? 一個常見的錯誤是您更改了服務器上的值,卻忘記了也更改了客戶端上的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.