0

enter code hereMy wcf service is not running in Test Client but running through browser and also when i am fetching through jquery

What might be problem

Error: Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

  <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="SimpleServiceBehavior">
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <webHttpBinding>
    <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
  </webHttpBinding>
</bindings>
<services>
  <service name="WcfService6.Service1">
    <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="webHttpBindingWithJsonP" contract="WcfService6.IService1"
              behaviorConfiguration="webHttpBehavior"/>
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  </service>
</services>

Mayur
  • 79
  • 1
  • 2
  • 16
  • Possible duplicate of [How to set that the WCF Test Client will run every time the service is running](https://stackoverflow.com/questions/7805818/how-to-set-that-the-wcf-test-client-will-run-every-time-the-service-is-running) – Volomike Oct 01 '17 at 20:46
  • First, look at the dupe question and then notice [this comment](https://stackoverflow.com/a/31223693/105539). Once done, follow [this tutorial](https://msdn.microsoft.com/en-us/library/bb386386.aspx). – Volomike Oct 01 '17 at 20:48

2 Answers2

0

Your probabily using a REST webservice configured to use HTTP methods. WCF Test client is a SOAP client and needs access to the webservice metadata to work.

Add the metadata configuration entry to your webservice configuration: http://msdn.microsoft.com/en-us/library/ms788760.aspx

In the configuration you posted you have two webservices configured. You should enable the metadata on the current webservice, not configure another webservice:

<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="webHttpBehavior" >
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
      <webHttp />
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <webHttpBinding>
    <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
  </webHttpBinding>
</bindings>
<services>
  <service name="WcfService6.Service1">
    <endpoint address="" binding="webHttpBinding"
              bindingConfiguration="webHttpBindingWithJsonP" contract="WcfService6.IService1"
              behaviorConfiguration="webHttpBehavior"/>
      <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  </service>
</services>

Please read this: WCF REST Service not visible in WCFTestClient

Community
  • 1
  • 1
Guilherme Duarte
  • 3,371
  • 1
  • 28
  • 35
0

you have to enable MetaData exchange for the service, using the config file, this will be under ServiceBehavior

<behaviors>
  <serviceBehaviors>
    <behavior name="SimpleServiceBehavior">
      <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" />
    </behavior>
  </serviceBehaviors>
</behaviors> 

try the following link

http://msdn.microsoft.com/en-us/library/ms734765.aspx

CSharped
  • 1,247
  • 4
  • 20
  • 49