【发布时间】:2009-03-16 15:15:30
【问题描述】:
我已经构建了一个通过 SOAP 和 RESTfully 公开的 WCF 服务。所有 SOAP 操作都按照宣传的方式工作。 GETS/PUTS 也可以,但是当我尝试对我的服务中的操作执行 POST 时,会返回以下错误:
“未找到端点”
IPersonEditServiceContract sn-p:
[OperationContract]
[WebInvoke(Method="POST",
UriTemplate="/persons",
RequestFormat=WebMessageFormat.Xml,
ResponseFormat=WebMessageFormat.Xml)]
SavePersonResponse SavePerson(SavePersonRequest request);
[OperationContract]
WebGet(UriTemplate = "/persons/{personId}",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Xml)]
Person GetClaimantById(string personId);
服务是这样配置的:
<behaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service>
<endpoint address="" binding="basicHttpBinding"
name="DefaultEndpoint"
bindingNamespace="http://mycompany.com/ServiceContracts"
contract="IPersonEditServiceContract" />
<endpoint
address="rest" binding="webHttpBinding"
name="RESTEndpoint"
bindingNamespace="http://mycompany.com/ServiceContracts"
contract="IPersonEditServiceContract"
behaviorConfiguration="restBehavior"/>
</service>
</services>
由于我可以对同一个端点执行其他 RESTful 操作,我不完全确定为什么它会给我这个半有用的错误。
想法?
【问题讨论】:
-
我也有同样的问题(