1
votes

i'm making a WCF RESTful application that will be uses in mobile applications. When I deploy these services in localhost all of them works, but when i deploy in my server just one service work, all the rest are giving me this error: "the remote server returned an error 400 bad request".

I was seaching about this problem and i found that it is originated in the web.config, because it wasn't configured in the right way. Here is the web.config, please help me. I'm breaking my head for this fix.

<?xml version="1.0"?>
<configuration>

<system.web>
    <compilation debug="true" targetFramework="4.0" />
</system.web>

<system.serviceModel>

    <services>
        <service name="Servicios.Mobile" behaviorConfiguration="ServiceBehaviour">
            <endpoint address="" binding="webHttpBinding" bindingConfiguration="wsHttp" contract="Servicios.IMobile" behaviorConfiguration="web">
            </endpoint>         
        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehaviour">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="web">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
    </behaviors>

    <bindings>
        <webHttpBinding>
            <binding name="wsHttp" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000">
                <readerQuotas maxDepth="500000000" maxArrayLength="500000000" maxBytesPerRead="500000000" maxNameTableCharCount="500000000" maxStringContentLength="500000000"/>
            </binding>
        </webHttpBinding>
    </bindings>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

</system.serviceModel>

<system.webServer>

    <modules runAllManagedModulesForAllRequests="true"/>

</system.webServer>

Thanks!

1
As I learned from painful experience, the "400 bad request" can mean almost anything. You may need to take a look at the actual response body and see what does it say. - Ilia G

1 Answers

1
votes

Not sure what the problem is, but it's quite easy to enable logging in WCF. The error you are getting is a generic one, enabling logging will show you the right error.

Check this post: http://intrepiddeveloper.wordpress.com/2008/08/07/security-event-logging-auditing/