我有接受JSON字符串實體WCF服務,這是方法:將大JSON發佈到我的WCF服務返回錯誤的請求?
更新:我解決了這個問題,因爲這是不相關的WCF服務,但對GSON格式,我使用,因爲不是像「ù」那樣格式化特殊字符,服務器拒絕接受這個字符。
<WebInvoke(UriTemplate:="UpdateUser", ResponseFormat:=WebMessageFormat.Json, RequestFormat:=WebMessageFormat.Json, Method:="POST", BodyStyle:=WebMessageBodyStyle.WrappedRequest)> _
Public Function UpdateUser(user As String) As Stream Implements IService1.UpdateUser
End Function
如果我嘗試後槽JAVA HttpClient的JSON字符串用下面的代碼,並與短JSON字符串的所有工作正常,但如果JSON字符串的尺寸越大,則與IIS 7.5的響應:
-MODULE_SET_RESPONSE_ERROR_STATUS 模塊名ManagedPipelineHandler 通知128 的HTTPStatus 400 HttpReason錯誤的請求 HttpSubStatus 0 錯誤碼0 ConfigExceptionInfo 通知 EXECUTE_REQUEST_HANDLER ErrorCode Operazione completata。 (0x0)
我已經在Web.Config中使用了MaxReceivedMessageSize和其他大小設置,但沒有成功。
這是我的web.config文件
<services>
<service name="WBVoice4Facebook.Service1" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="StreamedRequestWebBinding" contract="WBVoice4Facebook.IService1" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<netMsmqBinding>
<binding name="NewBinding0">
<security>
<transport msmqAuthenticationMode="None" msmqProtectionLevel="None" />
</security>
</binding>
</netMsmqBinding>
<webHttpBinding>
<binding name="StreamedRequestWebBinding"
openTimeout="10:15:00"
receiveTimeout="10:15:00"
sendTimeout="10:15:00"
bypassProxyOnLocal="true"
hostNameComparisonMode="WeakWildcard"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
transferMode="Streamed"
useDefaultWebProxy="false">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="InheritedFromHost" />
</security>
</binding>
</webHttpBinding>
</bindings>