开发者

wcftestclient fails, but only on remote machine

开发者 https://www.devze.com 2023-01-20 21:44 出处:网络
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.

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 fi开发者_如何学Cne.

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

<system.serviceModel>
        <protocolMapping>
            <remove scheme="http" />
            <add scheme="http" binding="customBinding" bindingConfiguration="gzipCompression" />
        </protocolMapping>
        <bindings>
            <customBinding>
                <binding name="gzipCompression">
                    <gzipMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" />
                </binding>
            </customBinding>
        </bindings>
        <extensions>
            <bindingElementExtensions>
                <add name="gzipMessageEncoding" type="Compression.GZIP.GZipMessageEncodingElement, Compression, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
            </bindingElementExtensions>
        </extensions>
        <behaviors>
            <!--<serviceBehaviors>
                <behavior name="CadServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"
                        httpGetBinding="" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>-->
        </behaviors>
        <services>
            <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" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost/CadServices" />
                        <add baseAddress="https://localhost:450/CadServices" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消