wcf – wcftestclient fails, but only on remote machine – Education Career Blog

I’ve got a wcf “self-hosted” service up and running and when communicating across machines i get The remote server returned an unexpected response: (405) Method not allowed. message.

This only seems to happen when running the WCF test client connecting to a remote machine. When running on the server, everything communicates fine.

i’m thinking it has something to do with security, but i’m not sure where to look.

Can anyone point out what i’m missing or doing wrong?

below is my server config file

            <remove scheme="http" />
            <add scheme="http" binding="customBinding" bindingConfiguration="gzipCompression" />
                <binding name="gzipCompression">
                    <gzipMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" />
                <add name="gzipMessageEncoding" type="Compression.GZIP.GZipMessageEncodingElement, Compression, Version=, Culture=neutral, PublicKeyToken=null" />
                <behavior name="CadServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"
                        httpGetBinding="" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
            <service behaviorConfiguration="CadServiceBehavior" name="CadServiceLibrary.CadServiceContract">
                <endpoint address="com" binding="customBinding" bindingConfiguration="gzipCompression"
                    name="com" contract="CadServiceLibrary.CadServiceContract" />
                <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                    name="mex" contract="IMetadataExchange" />
                <endpoint binding="wsHttpBinding" bindingConfiguration="" name="ws"
                    contract="CadServiceLibrary.CadServiceContract" />
                        <add baseAddress="http://localhost/CadServices" />
                        <add baseAddress="https://localhost:450/CadServices" />


I have seen this before although not sure if it is your problem:

Instead of localhost, put your server’s name or IP address. If IP address, make sure the same IP address is selected in IIS (I assume you are hosting this in IIS).

When localhost is used, I have had difficulty in the past accessing it from remote machines – although listening on localhost works fine with TCP.

Leave a Comment