This is a migrated thread and some comments may be shown as answers.

Issues with WCF Data Services ODataV3

1 Answer 163 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ants
Top achievements
Rank 1
Ants asked on 21 Nov 2013, 01:52 AM
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/"));
        host.Open();
    }
}

Thanks

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 25 Nov 2013, 03:37 PM
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/") }))
{
    host.Open();
 
    Console.ReadLine();
}

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.

Regards,
Alexander
Telerik
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!
Tags
Web Services
Asked by
Ants
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or