0

A WCF service needs to be capable to SOAP and REST format. It returns Bad Request (400), below is my web config file:

<system.serviceModel>
            <bindings>
                    <basicHttpBinding>
                        <binding name="BasicHttpBinding_ILoginSVC" allowCookies="true" maxBufferPoolSize="20000000" maxBufferSize="70000000" maxReceivedMessageSize="70000000">
                        </binding>
                    </basicHttpBinding>
                    <webHttpBinding>
                        <binding name="webHttpBindingILoginSVC" allowCookies="true" maxBufferSize="100000000" maxBufferPoolSize="100000000" maxReceivedMessageSize="100000000" crossDomainScriptAccessEnabled="true" />
                    </webHttpBinding>
                </bindings>
            <services>
                <service name="LoginSVC.LoginSVC">
                    <host>
                        <baseAddresses>
                            <add baseAddress="http://localhost:59900/LoginSVC" />
                        </baseAddresses>
                    </host>
                    <endpoint address="" binding="basicHttpBinding" contract="LoginSVC.ILoginSVC">
                        <identity>
                            <dns value="localhost" />
                        </identity>
                    </endpoint>
                    <endpoint address="REST" binding="webHttpBinding" contract="LoginSVC.ILoginSVC" behaviorConfiguration="RESTEndPointBehaviour">
                    </endpoint>
                </service>
            </services>
        </system.serviceModel>
woo25
  • 5
  • 6

1 Answers1

0

In your configuration file, you have not assigned the binding configuration you created, so use the default BasicHttpBinding. You need to explicitly assign the binding you defined (BasicHttpBinding_ILoginSVC) to your endpoint like this:

<endpoint address="" bindingConfiguration="BasicHttpBinding_ILoginSVC" binding="basicHttpBinding" contract="LoginSVC.ILoginSVC" />
Lan Huang
  • 613
  • 2
  • 5
  • I added the bindingConfiguration="BasicHttpBinding_ILoginSVC" still returns Bad Request – woo25 Mar 04 '22 at 07:09
  • Maybe you can look at the documentation and reorganize the config file.https://www.c-sharpcorner.com/article/enable-soap-and-rest-on-same-wcf-service-and-contract/ and https://stackoverflow.com/a/2295887/17218587 . – Lan Huang Mar 07 '22 at 07:36