[英]Cannot get Metadata with WCF
我正在尝试设置一个返回JSON对象的Web服务,而我正在按照本教程进行操作,但是当我尝试运行它时,出现此错误
错误:无法从
http://localhost:10995/Service1.svc
获取元数据。如果这是您有权访问的Windows(R)Communication Foundation服务,请检查是否已在指定地址启用元数据发布。 有关启用元数据发布的帮助,请参阅MSDN文档, 网址为http://go.microsoft.com/fwlink/?LinkId=65455。WS-MetadataExchange错误URI:http://localhost:10995/Service1.svc
元数据包含无法解析的引用:“ localhost:10995 / Service1.svc”。 远程服务器返回了意外的响应:(405)不允许使用方法。 远程服务器返回错误:(405)不允许的方法http://localhost:10995/Service1.svc
GET错误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"/>
将名称空间名称与您的服务名称和合同名称一起使用...请参见下面的代码段:
<service name="WcfService3.Service1"
behaviorConfiguration="ServiceBehavior">
>
<endpoint address="../Service1.svc" binding="wsHttpBinding" contract="WcfService3.IService1">
其中“ WcfService3”是名称pcae。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.