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

entity-framework wcf

Question

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...

1
24
2/17/2014 3:18:05 AM

Accepted Answer

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.

23
11/16/2016 1:42:29 AM

Popular Answer

The actual error can be different. In my case I got the same general error message when starting with AdventureWorks2012 database.

So the actual problem can be seen by appending an attribute to the service class as described at here:

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class WcfDataServiceAW : EntityFrameworkDataService<AdventureWorks2012Entities> { ... }

Hope it helps someone.

PS. My error is:

The exception message is 'The property 'SpatialLocation' on type 'Address' is of type 'Geography' which is not a supported primitive type.'.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow