0

I am trying to set a web services that return JSON objects and I was following this tutorial but when I go try to run it I get this error

Error: Cannot obtain Metadata from http://localhost:10995/Service1.svc 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: http://localhost:10995/Service1.svc Metadata contains a reference that cannot be resolved: 'localhost:10995/Service1.svc'. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed.HTTP GET Error URI: http://localhost:10995/Service1.svc There was an error downloading http://localhost:10995/Service1.svc. The request failed with HTTP status 404: Not Found.

So I tried looking up what that means and came across these links to try to fix it

WCF - Cannot obtain Metadata

WCF - Error: Cannot obtain Metadata

Error: Cannot obtain Metadata from WCF service

WCF Test Client cannot add service, cannot obtain metadata

but none of them fixed the problem. This is my first attempt at doing any sort of web service stuff and I literally started researching today so obviously I am new to all of this.

what does this error mean and how can I fix it so I can test it out?

<system.serviceModel>
<services>
  <service name="WcfService4.Service1" behaviorConfiguration="WcfService4.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="../Service1.svc"
      binding="webHttpBinding"
      contract="WcfService4.IService1"
      behaviorConfiguration="webBehaviour" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="WcfService4.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="webBehaviour">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>

Community
  • 1
  • 1
tyczj
  • 71,600
  • 54
  • 194
  • 296

3 Answers3

0

its not just a typo is it?

contract="WcfService4e.IService1" 

is it supposed to be

contract="WcfService4.IService1"
sa_ddam213
  • 42,848
  • 7
  • 101
  • 110
0

try this

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
Jayant Varshney
  • 1,765
  • 1
  • 25
  • 42
0

use namespace name with your service name and contract name... See the code snippet below:

<service name="WcfService3.Service1"
 behaviorConfiguration="ServiceBehavior">
>         
<endpoint address="../Service1.svc" binding="wsHttpBinding" contract="WcfService3.IService1">

where "WcfService3" is the namespcae.

sandip
  • 1