Итак, из-за некоторых организационных проблем я разделил то, что изначально было единым интерфейсным контрактом, на два отдельных.Теперь у меня есть только один класс, реализующий оба интерфейса, и я хочу сделать их доступными как REST-сервисы через WCF.Контракты перечислены ниже:
1-й:
[ServiceContract]
public interface INotification
{
[OperationContract]
[WebGet]
XElement GetInfo(string appID);
[OperationContract]
[WebGet]
void RegisterRID(string appID, string registrationID);
}
2-й:
[ServiceContract]
public interface IPlanning
{
[OperationContract]
[WebGet]
XElement PlanTrip(string toDestination, string fromDestination, int year, int month, int day, int hour, int minute, string appID);
[OperationContract]
[WebGet]
XElement PlanTripDelayed(string toDestination, string fromDestination, int year, int month, int day, int hour, int minute, string appID);
[OperationContract]
[WebGet]
XElement PlanTripLoc(string toDestination, string fromLat, string fromLong, int year, int month, int day, int hour, int minute, string appID);
}
Мой app.config выглядит следующим образом:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="RESTFriendly">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="TravelPlannerWebService.Domain.Entity.ETravelPlanner">
<endpoint binding="webHttpBinding" bindingConfiguration="" contract="TravelPlannerWebService.Acquaintance.IPlanning" behaviorConfiguration="RESTFriendly" />
<endpoint binding="webHttpBinding" bindingConfiguration="" contract="TravelPlannerWebService.Acquaintance.INotification" behaviorConfiguration="RESTFriendly" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:80" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
Проблема в том, что всякий раз, когда я пытаюсь использовать два интерфейса, я получаю сообщение об ошибке.Просматривая мой app_tracelog.svclog (я намеренно удалил отладочный код из app.config здесь), я вижу, что получаю следующую ошибку:
Сообщение: найдено несколько фильтров.
Stack Trace:
System.ServiceModel.Dispatcher.EndpointDispatcherTable.LookupInCache(Message message, Boolean& addressMatched)
System.ServiceModel.Dispatcher.EndpointDispatcherTable.Lookup(Message message, Boolean& addressMatched)
System.ServiceModel.Dispatcher.ChannelHandler.GetDatagramChannel(Message message, EndpointDispatcher& endpoint, Boolean& addressMatched)
System.ServiceModel.Dispatcher.ChannelHandler.EnsureChannelAndEndpoint(RequestContext request)
System.ServiceModel.Dispatcher.ChannelHandler.TryRetrievingInstanceContext(RequestContext request)
System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)
System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
System.Runtime.InputQueue`1.AsyncQueueReader.Set(Item item)
System.Runtime.InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread)
System.Runtime.InputQueue`1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread)
System.ServiceModel.Channels.SingletonChannelAcceptor`3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread)
System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContextCore(IAsyncResult result)
System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContext(IAsyncResult result)
System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
System.Net.LazyAsyncResult.Complete(IntPtr userToken)
System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
System.Net.ListenerAsyncResult.WaitCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Понятия не имею, как это решить.Насколько я могу видеть из следующих руководств, это правильный способ использовать один и тот же тип для нескольких конечных точек.Есть идеи?