I am trying to get a WCF data service server that has been running for several days. I finally retreated today and just tried to do what a quick start shows. Nothing else .. and in a completely new project. Of course it will work.
But this is not so .. it failed just like my other tests.
I just follow suit. Using Visual Studio 2013 for web express and hosting uses IIS Express. I installed WCF Tools version 5.6, so Visual Studio has a WFC Data Service 5.6 template.
Its essence is that
create an ASP.Net application Select the type of MVC without adding any folders for anything other than MVC, and no unit tests, individual account authentication.
Add the Entity ADO.Net data model for the NorthWind database called NorthwindEntities in web.config, importing all the tables.
Add a WCF 5.6 service data item, name it NorthWind.svc.
Change the NorthWind.svc.cs support code to the following.
using System; using System.Collections.Generic; using System.Data.Services; using System.Data.Services.Common; using System.Linq; using System.ServiceModel.Web; using System.Web; namespace StackOverflowApp { public class NorthWindService : DataService<NorthwindEntities> {
Now it is ready to be created and launched .. it should work .. yes?
I run it and go to the service. I am greeted by the following complaint.
<div id="content"> <p class="heading1">Request Error</p> <p>The server encountered an error processing the request. See server logs for more details.</p> </div>
How do I debug this? This is not a typical answer when going to a page that generates an error in the application or on a page that does not exist. I have a feeling that the data.service system is generating this response .. that it actually started processing the request .. but failed for some stupid reason.
I followed the instructions that I thought, but apparently I missed something. I went through the process several times to try and find what I might have missed to no avail.
Update:
Aha .. on another similar issue, they recommended adding verbose messages using config.UserVerboseErrors = true . It didn't matter to me ... but the alternative method of using attributes was sure! Decorating the class [ServiceBehavior(IncludeExceptionDetailInFaults = true)] now gives this more descriptive error.
The server encountered an error processing the request. The exception is the message 'Type expression' System.Data.Entity.Core.Objects.ObjectContext 'cannot be used to return type' System.Data.Objects.ObjectContext ''. See Server logs for more details. Trace exception stack: blahblah