我有两个 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);
}
我要访问的 URL 是: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>