2010-03-16 18 views
5

Ricevo questa eccezione quando provo ad accedere a un servizio Web wcf.WCF, Il server remoto ha restituito un errore: (400) Richiesta errata

[WebException: The remote server returned an error: (400) Bad Request.] 
    System.Net.HttpWebRequest.GetResponse() +5314029 
    System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +54 

Server Binding Informazioni

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="wcfSmartConnect" closeTimeout="10:01:00" 
        maxBufferSize="104857600" maxBufferPoolSize="104857600" 
        maxReceivedMessageSize="104857600" openTimeout="10:01:00" 
        receiveTimeout="10:10:00" sendTimeout="10:01:00" 
        messageEncoding="Mtom" transferMode="StreamedRequest"> 
      <readerQuotas maxDepth="104857600" maxStringContentLength="104857600" 
          maxArrayLength="104857600" maxBytesPerRead="104857600" 
          maxNameTableCharCount="104857600" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="WcfSmartConnect.Service1" 
       behaviorConfiguration="WcfSmartConnect.Service1Behavior"> 
     <endpoint 
       address="" 
       binding="basicHttpBinding" 
       bindingConfiguration="wcfSmartConnect" 
       contract="WcfSmartConnect.IService1"> 
      <identity> 
       <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint 
       address="mex" 
       binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="WcfSmartConnect.Service1Behavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
       <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

client di associazione Informazioni

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="wcfSmartConnect" closeTimeout="10:01:00" 
        maxBufferSize="104857600" maxBufferPoolSize="104857600" 
        maxReceivedMessageSize="104857600" openTimeout="10:01:00" 
        receiveTimeout="10:10:00" sendTimeout="10:01:00" 
        messageEncoding="Mtom" transferMode="StreamedRequest"> 
      <readerQuotas maxDepth="104857600" maxStringContentLength="104857600" 
          maxArrayLength="104857600" maxBytesPerRead="104857600" 
          maxNameTableCharCount="104857600" /> 
     </binding> 
     </basicHttpBinding> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IService11" closeTimeout="01:00:00" 
        openTimeout="01:00:00" receiveTimeout="01:00:00" 
        sendTimeout="01:00:00" bypassProxyOnLocal="false" 
        transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
        maxBufferPoolSize="1048576000" maxReceivedMessageSize="1048576000" 
        messageEncoding="Text" textEncoding="utf-8" 
        useDefaultWebProxy="true" allowCookies="false"> 
       <readerQuotas maxDepth="104857600" maxStringContentLength="104857600" 
          maxArrayLength="104857600" maxBytesPerRead="1048576000" 
          maxNameTableCharCount="104857600" /> 
       <reliableSession ordered="true" inactivityTimeout="00:10:00" 
           enabled="false" /> 
       <security mode="TransportWithMessageCredential"> 
        <transport clientCredentialType="Windows" 
           proxyCredentialType="None" realm="" /> 
        <message clientCredentialType="Windows" 
          negotiateServiceCredential="true" algorithmSuite="Default" 
          establishSecurityContext="true" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint name="WSHttpBinding_IService11" 
      address="http://abc.com/API/serv.svc" 
      binding="wsHttpBinding" 
      bindingConfiguration="WSHttpBinding_IService11" 
      contract="SmartConnectRepublic.IService1" > 
      <identity> 
       <dns value="localhost" /> 
      </identity> 
     </endpoint> 
     <endpoint name="BasicHttpBinding_IService1" 
      address="http://localhost:4649/Service1.svc" 
      binding="basicHttpBinding" 
      bindingConfiguration="wcfSmartConnect" 
      contract="SmartConnect.IService1" /> 
    </client> 
</system.serviceModel> 
+0

e quali attacchi si stanno effettivamente utilizzando ?? BasicHttpBinding o wsHttpBinding ?? –

risposta

2

Puoi dirci un po 'sulla vostra configurazione?

  • che legame usi?
  • è questo l'unico metodo di servizio? Se no: gli altri funzionano?
  • mostraci le configurazioni su client e server! (Tutto dentro <system.serviceModel> è di interesse)

Sembrerebbe come se i tempi di client di attesa per il server - questo può essere perché il server richiede troppo tempo per rispondere (se si fa un sacco di caricamento dei dati); in tal caso, è necessario aumentare i timeout sul server e sul client

Oppure si potrebbe inviare un pacchetto di dati troppo grande sul cavo - in tal caso, potrebbe anche essere necessario aumentare le impostazioni per maxReceivedMessageSize e altri .

@Pinu: stai cercando di caricare 5 MB? Hai transferMode = StreamRequest, il che significa che la tua richiesta dal client al server verrà trasmessa in streaming.

Se si trasferiscono 5 MB, è una buona idea eseguire lo streaming - in che modo si trasferiscono quei byte?

+0

Ehi Marc, ho aggiornato le informazioni del file di configurazione. Stiamo cercando di inviare 5 MB (massimo). e ho già visto maxreceivedmessagesize = 100mb. Quindi non penso che dovrebbe essere il problema – Pinu

+0

Ehi Marc, sta lanciando quell'errore quando abilito transfermode = "stream" sta lanciando questo errore. Con transfermode = buffer mi consente di inviare fino a 3 MB di file. Sto anche utilizzando il contratto dei messaggi e il flusso di memoria per richiedere il flusso di memoria – Pinu

Problemi correlati