Solved

Simple WCF Data Service Not working

Posted on 2014-11-10
3
320 Views
Last Modified: 2015-02-16
Hello,

I created a simple WCF Data Service in an ASP.NET web forms application to use with a Telerik grid, and the service doesn't work.  It returns nothing to the grid, and when I try to browse to the service itself I get "Request Error
The server encountered an error processing the request. See server logs for more details."

My IISExpress log gives me this:  
2014-11-10 14:47:46 ::1 GET /QAD_Trans.svc/ - 53096 zzz\zzz::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/38.0.2125.111+Safari/537.36 - 500 0 0 124

The entirety of the code for the service is this:
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;
using System.Linq.Dynamic;

namespace QAD_Transactions_Grid
{
    public class QAD_Trans : DataService<PTMDataMartEntities>
    {
     // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
        }
        [WebGet]
        public int GetCount(string where)
        {        

            return String.IsNullOrEmpty(where) ? CurrentDataSource.QAD_Transactions.Count() :
                 CurrentDataSource.QAD_Transactions.Where(where).Count();
        }
    }
}

Open in new window


Any ideas?  

Thanks
0
Comment
Question by:Martin Bertram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 81

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40434287
500 is an internal server error.  Use it on a real IIS is my suggestion.
0
 

Author Comment

by:Martin Bertram
ID: 40434989
Thanks David.  I get the same thing on IIS.  

2014-11-11 14:15:54 172.16.0.2 GET /QAD_Transactions_Grid/QAD_Trans.svc/ - 80 - 172.16.2.10 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/38.0.2125.111+Safari/537.36 500 0 0 218
0
 

Author Comment

by:Martin Bertram
ID: 40612032
It was because I was using Entity Framework v6.  Apparently it has to be v5 to work.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question