SORU
24 NİSAN 2009, Cuma


Büyük XML web service (400) Bad Request HTTP isteği başarısız

Görünüşe göre bu ortak sorunla karşılaştı ve bunu çözmek için geçiremedi ettim.

Eğer benim XML bir dizi parametre öğeleri nispeten az sayıda (50 kadar test ettim) ile servis web ararsam, her şey yolunda.

Ancak eğer 500 öğeleri ile web servis arama, Bad Request hatası alıyorum.

İlginçtir, sunucu üzerinde Wireshark koştum ve isteği bile sunucu vurmak değil görünür - 400 hata istemci tarafında oluşturuluyor.

İstisna olarak

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.

İstemci yapılandırma dosyası system.serviceModel Bölüm:

<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>

Sunucu tarafında, web.yapılandırma dosyası system.serviceModel aşağıdaki bölüm vardır:

<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>

looked at I no success 15 answers fairly large number bir.

Bu konuda bana yardımcı olabilir misiniz?

CEVAP
24 NİSAN 2009, Cuma


Sunucu çok, örneğin 4 MB: maxReceivedMessageSize ayarlamayı deneyin

    <binding name="MyService.MyServiceBinding" 
           maxReceivedMessageSize="4194304">

Varsayılan (inanıyorum 65535) çok düşük olmasının ana nedeni, Hizmet Reddi (DoS) saldırıları riskini azaltmak için. Bu sunucuda en yüksek istek boyutu ve istemci üzerinde en büyük yanıt boyutu daha büyük ayarlamanız gerekir. Eğer bir İntranet ortamında iseniz, DoS saldırıları riskini muhtemelen güvenli bir değer gerekiyor beklediğinizden çok daha yüksek kullanmak için büyük bir olasılıkla düşük.

Bu arada, sorunları gidermek için birkaç ipucu WCF hizmetleri için bağlantı kurmak

  • this MSDN article açıklandığı gibi sunucu üzerinde izleme etkinleştirin.

  • İstemci Fiddler gibi bir HTTP hata ayıklama aracı HTTP trafiği denetlemek için kullanın.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • CMTelly

    CMTelly

    2 Mayıs 2007
  • Joanna Okrajni

    Joanna Okraj

    4 EYLÜL 2010
  • WOSU Public Media

    WOSU Public

    23 AĞUSTOS 2007