2012-07-17 72 views
4

我有接受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> 

回答

0

还有在asp.net运行时的限制。 更多信息here