He encontrado este problema aparentemente común y no he podido resolverlo.Solicitud de servicio web WCF grande que falla con (400) HTTP Bad Request
Si llamo a mi servicio web WCF con un número relativamente pequeño de elementos en un parámetro de matriz (he probado hasta 50), todo está bien.
Sin embargo, si llamo al servicio web con 500 elementos, aparece el error de Solicitud incorrecta.
Curiosamente, he ejecutado Wireshark en el servidor y parece que la solicitud ni siquiera está llegando al servidor: el error 400 se está generando en el lado del cliente.
La excepción es:
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
La sección system.serviceModel
de mi archivo de configuración de cliente es:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://serviceserver/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="SmsSendingService.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
En el lado del servidor, mi archivo web.config tiene la siguiente system.serviceModel
sección:
<system.serviceModel>
<services>
<service name="MyService.MyService" behaviorConfiguration="MyService.MyServiceBehaviour" >
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyService.MyServiceBinding" contract="MyService.IMyService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="MyService.MyServiceBinding">
<security mode="None"></security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyService.MyServiceBehaviour">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
He looked at un fairly largenumber de answers a this question con no success.
¿Alguien me puede ayudar con esto?
Si no está llegando al servidor, tal vez haya algún problema con los datos que se envían. Tal vez hay algunos personajes ilegales en la solicitud? Suponiendo también que esto es SOAP –
, ¿ha intentado configurar todos sus atributos 'max' (por ejemplo, maxReceivedMessageSize ...) a un número realmente alto? – mundeep
Sí, es JABÓN. Y no debería haber nada de malo en la solicitud, como dije, todo funciona bien para hasta 50 elementos generados con la misma aplicación ... – Damovisa