WCF错误使用WCFTestClient来测试一个简单的WCF Web服务

当我尝试使用“wcftestclient”测试AutoLotWCFService时,我收到以下错误.我究竟做错了什么?任何见解将有所帮助.这是一个简单的Web服务,具有wshttpbinding与接口合同和服务中的实现.以下是长错误消息:Web.Config文件有2个端点 – 一个用于Web Service本身,另一个用于MetaDataExchange.它几乎是认的东西.如果需要,我可以包含代码 – 似乎我无法在这里附加文件.
Error: Cannot obtain Metadata from http://localhost/AutoLotWCFService/Service.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/AutoLotWCFService/Service.svc
    Metadata contains a reference that cannot be resolved: 'http://localhost/AutoLotWCFService/Service.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/AutoLotWCFService/Service.svc
    The document at the url http://localhost/AutoLotWCFService/Service.svc was not recognized as a kNown document type.The error message from each kNown type may help you fix the problem:
    - Report from 'disCO Document' is 'Name cannot begin with the '%' character,hexadecimal value 0x25. Line 1,position 2.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1,2).' -Name cannot begin with the '%' character,position 2.
    - Report from 'XML Schema' is 'Name cannot begin with the '%' character,position 2.'.

解决方法

我最近遇到这个问题,同时试图在IIS7下的Windows Vista笔记本电脑上托管WCF.

我首先收到以下错误:“HTTP错误404.3 – 未找到”,建议的其中一个解决方案是“确保当前页面的预期处理程序被映射”.

所以我手动添加一个.svc文件的处理程序,并将其定义为discoveryRequestHandler,认为这可能有帮助.这导致您上述的问题.

实际的解决方法删除添加的处理程序,并运行以下命令:

CD c:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
ServiceModelReg -i

解决了我的问题,服务正常.我希望这可能有助于揭示你的问题.我不能确定,但​​这可能是因为我在我的笔记本电脑上安装了各种软件包的顺序.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 <div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些