Search code examples
wcfentity-framework

The server encountered an error processing the request. See server logs for more details


I have a simple problem.

I've created a WCF Data Service 5.6 in visual studio 2013, and in its *.svc.cs file, modified line

public class CustomdataService : DataService< /* TODO: put your data source class name here */ >

to connect my entities

public class CustomdataService : DataService< SchedulerEntities >

But when I want to see the service in browser it gives me following error

Request Error

The server encountered an error processing the request. See server logs for more details.

The entity framework is nothing but a single table...


Solution

  • It seems that Entity Framework 6 and WCF Data Services 5.6.0 need some provider to work together, read more on Using WCF Data Services 5.6.0 with Entity Framework 6+.

    You can download the provider simply by using NuGet Package Console Manager:

    Install-Package Microsoft.OData.EntityFrameworkProvider -Pre
    

    Its version is alpha 2, so in future, search for final release. it worked for me however.

    Final thing is, instead of using DataService<T>, you need to use EntityFrameworkDataService<T>. T is the name of your entities.