C# 无法使用WCF获取元数据

C# 无法使用WCF获取元数据,c#,wcf,web-services,C#,Wcf,Web Services,我试图设置一个返回JSON对象的web服务,我一直在关注这个问题,但是当我尝试运行它时,我得到了这个错误 错误:无法从http://localhost:10995/Service1.svc 如果这是一个Windows(R)通信基础服务 具有访问权限,请检查是否已在启用元数据发布 指定的地址。有关启用元数据发布的帮助,请 请参阅位于的MSDN文档 交换 错误URI:http://localhost:10995/Service1.svc元数据包含 无法解析的引用: '本地主机:10995/Servi

我试图设置一个返回JSON对象的web服务,我一直在关注这个问题,但是当我尝试运行它时,我得到了这个错误

错误:无法从
http://localhost:10995/Service1.svc
如果这是一个Windows(R)通信基础服务 具有访问权限,请检查是否已在启用元数据发布 指定的地址。有关启用元数据发布的帮助,请 请参阅位于的MSDN文档 交换 错误URI:
http://localhost:10995/Service1.svc
元数据包含 无法解析的引用: '本地主机:10995/Service1.svc'。远程服务器返回 不允许出现意外响应:(405)方法。远程服务器 返回错误:(405)不允许使用方法。HTTP获取错误URI:
http://localhost:10995/Service1.svc
下载时出错
http://localhost:10995/Service1.svc
。请求因HTTP而失败 状态404:未找到

所以我试着查找这意味着什么,并找到这些链接试图修复它

但他们都没有解决这个问题。这是我第一次尝试做任何类型的web服务,我从今天开始研究,显然我对所有这些都是新手

这个错误意味着什么?我如何修复它以便测试它

<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>


这不仅仅是打字错误,是吗

contract="WcfService4e.IService1" 
应该是吗

contract="WcfService4.IService1"
试试这个

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

将命名空间名称与服务名称和合同名称一起使用。。。看见 下面是代码片段:


>         

其中,“WcfService3”是名称PCAE。

请正确检查端点地址、行为配置和合同名称。因此,不要选择向上投票的答案或绿色勾选。。你知道什么能解决这个问题吗?
<service name="WcfService3.Service1"
 behaviorConfiguration="ServiceBehavior">
>         
<endpoint address="../Service1.svc" binding="wsHttpBinding" contract="WcfService3.IService1">