Can it combine a WCF service into a DataService? RRS feed

  • Question

  • Hello all, 
           I am trying to implement a standard WCF service into a DataService, the code is like this:
        public interface IService1
            void DoSomething();
    public class WebDataService1 : DataService<TestModelContainer>, IService1
            public static void InitializeService(IDataServiceConfiguration config)
                config.UseVerboseErrors = true;
                config.SetEntitySetAccessRule("*", EntitySetRights.All);
                config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
           public void DoSomething()

    but when i start the service, i response this exception info:

    Service 'WebDataService1' implements multiple ServiceContract types, and no endpoints are defined in the configuration file. WebServiceHost can set up default endpoints, but only if the service implements only a single ServiceContract. Either change the service to only implement a single ServiceContract, or else define endpoints for the service explicitly in the configuration file.

    the exception seems thrown by the WCF core, i don't understand that, after all i had try to add the 'endpoint' config by the WCF config editor, but the error still exist

    thanks for any help :)

    Thursday, September 3, 2009 9:52 AM


  • Hi ,
     The base class of all Data Services : Dataservice<T> already implements a ServiceContract called IRequestHandler.
      WCF does not allow multiple ServiceContract types for a given Service.
      Hence , the above error is expected. 
    You could move the IService1 implementation to another WCF service and not inside a Data Service .
    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Thursday, September 3, 2009 4:44 PM