Issues with WCF Data Services ODataV3

Thread is closed for posting
2 posts, 0 answers
  1. Ants
    Ants avatar
    3 posts
    Member since:
    Dec 2012

    Posted 20 Nov 2013 Link to this post

    Hi there, I created an empty ASP.NET project to use as the host project for my OpenAccess service.
    I created it as a WCF Data Service ODataV3 service.
    When I run it within my local IIS server (Win8.1), requests are taking about 100-200ms, when I deploy it to a WinServer2012 machine, requests take 1-5x longer, minimum of 500ms, even though the database server is physically closer (though I've tested, this doesn't seem to matter)
    It just seems to be a matter of WCF overheads, but 500ms is too much, especially for very simple/quick queries.
    I previously migrated away from WebAPI service where the calls were much much faster but I had too limited support for OData (particularly, $expand).
    Anyway during my testing, I was trying to use different configurations, but I can't figure out how to use different bindings for the Telerik service.
    No matter what I try, I keep getting this error:

    The operation 'ProcessRequestForMessage' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

    What contract interface should I be using for endpoints? Searching on the internet leads me to believe it should be System.Data.Services.IRequestHandler

    How do I self-host this application? I have this code in a console application but I just keep getting the above error.

    static void Main(string[] args)
        using (var host = new ServiceHost(typeof(TelerikJMXModelService)))
            host.AddServiceEndpoint(typeof (IRequestHandler), new BasicHttpBinding(), new Uri("http://localhost:8888/"));

  2. Alexander
    Alexander avatar
    727 posts

    Posted 25 Nov 2013 Link to this post

    Hello Ants,

    In order to host the data service in a console application you will have to use the DataServiceHost class instead of just ServiceHost. The code that worked on my side is almost the same as yours:
    using (var host = new DataServiceHost(typeof(EntitiesModelService), new Uri[] { new Uri("http://localhost:8888/") }))

    Regarding the error you get, it is because of the BasicHttpBinding that you are trying to use. It seems you could use only WebHttpBinding for a data service. Some more information on the topic is available in this Stack Overflow thread.
    Hope that helps to get your service running.

    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top