0
votes

the service DOES work normally, but for some reason, I an unable to use wcftestclient.exe from my local pc to the server - I Want to call a method using wcftestclient.exe.

Its all company-internal, self-hosting (running within windows service, no iis). framework 4. Basichttpbinding, no need for anything secure.

Here is my servicemodelconfig ...

<system.serviceModel>
    <services>
      <service name="myService">

        <endpoint
          address="http://servername:8001/myService" 
          binding="basicHttpBinding"
          contract="IMyService" />

      </service>
    </services>


    <behaviors>
      <serviceBehaviors>
        <behavior name ="MyDefaultBehaviour">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://servername:8001/myService/mex" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="1" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

I get ...

Error: Cannot obtain Metadata from If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI:

Metadata contains a reference that cannot be resolved:'. Content Type application/soap+xml; charset=utf-8 was not supported by service

The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error URI:

There was an error downloading 'http://

The request failed with HTTP status 400: Bad Request.

I 've blanked out our servernames above, so lots of blanks, but hopefully the message is clear enough.

I did experiment with adding additional endpoint ...

<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />

but with this, the windows service wouldn't start.

Thanks

----- added later --- have also tried this, but once again, service doesn't start

<system.serviceModel>
    <services>
      <service name="myService" behaviorConfiguration="MyDefaultBehaviour">
        <host>
          <baseAddresses>
            <add baseAddress="http://myServer:8001/myService" />
          </baseAddresses>
        </host>

        <endpoint
          address=""
          binding="basicHttpBinding"
          contract="Contracts.ImyService" />

        <endpoint
          address="mex"
          binding="mexHttpBinding"
          contract="IMetaDataExchange" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name ="MyDefaultBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="1" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
2

2 Answers

0
votes

If you add the mexendpoint, you need to add the baseAddress: like below:

<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9999/WcfTcp/Service1"/>
          </baseAddresses>
        </host>
0
votes

My second config DOES work after all, ie, w ith the basaddresses, the empty string for the standard endpoint, and the "mex" endpoint. IMetadataExchange was spelt with incorrect capital D. Sorted. Thanks very much @Grady