Solved

Simple WCF Data Service Not working

Posted on 2014-11-10
3
279 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
  • 2
3 Comments
 
LVL 78

Accepted Solution

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

Author Comment

by:Martin Bertram
Comment Utility
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
Comment Utility
It was because I was using Entity Framework v6.  Apparently it has to be v5 to work.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now