【发布时间】:2012-04-09 08:47:16
【问题描述】:
我有两个 WCF 服务 Exchange1.svc 和 Exchange2.svc 都设置为 RESTful JSON 消耗品。 Exchange1.svc 工作正常,但当我尝试发布到 Exchange2.svc 时,我收到 Endpoint not found 消息。
我做错了什么?
我的 IExchange2 接口是:
[ServiceContract]
public interface IExchange2
{
[System.ServiceModel.OperationContract(Name = "InsertReading")]
[WebInvoke(UriTemplate = "/InsertReading?memberID={memberID}", Method = "POST", ResponseFormat = WebMessageFormat.Json)]
void InsertReading(string memberID);
}
我要访问的网址是:http://localhost:49701/Exchange2.svc/DiaInsertReading?memberID=6519548
我的配置是:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="MyNamespace.Exchange1Behavior">
<webHttp/>
</behavior>
<behavior name="MyNamespace.Exchange2Behavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="MyNamespace.Exchange1">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="MyNamespace.Exchange1Behavior" contract="MyNamespace.IExchange1" />
</service>
<service name="MyNamespace.Exchange2">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="MyNamespace.Exchange2Behavior" contract="MyNamespace.IExchange2" />
</service></services></system.serviceModel>
【问题讨论】:
-
刚刚错过了我现在在原帖中更新的部分网址...
标签: c# wcf web-services rest