Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:11:11+00:00 2026-05-23T16:11:11+00:00

My service interface is: [ServiceContract] public interface IMyService { [OperationContract] [WebInvoke(Method = GET, ResponseFormat

  • 0

My service interface is:

[ServiceContract]
public interface IMyService
{
    [OperationContract]
    [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "HelloJSON/{name}")]
    string HelloJSON(string name);

    [OperationContract]
    [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetEmployees")]
    List<Employee> GetEmployees();
}

My implementation is:

public class MyService : IMyService
{
    public string HelloJSON(string name)
    {
        return string.Format("Hello {0} in JSON", name);
    }

    public List<Employee> GetEmployees()
    {
        using (DBEntities ctx = new DBEntities())
        {
            List<Employee> emp = new List<Employee>();
            emp = (from e in ctx.Employee select e).ToList();
            return emp;
        }
    }
}

When I call the first method I get something like “Hello pepe in JSON”, that’s ok.

When I call the second method and set a breakpoint on line “return emp;” I get the list of the employees(there are 6 records from the database), but in IE I get this:

Internet Explorer cannot display the webpage

and testing in Firefox all I get is a blank page with a blank body, no HTML, no data and no errors.

I think WCF can’t serialize my default EF4 entities.

EDIT:

My final solution was something(not exactly) like this:

static string SerializeJSON<T>(T obj) {
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    return serializer.Serialize(obj); }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:11:12+00:00Added an answer on May 23, 2026 at 4:11 pm

    EF entities cannot be serialized by default you must add code generation to them.

    Refer to this article on how to create Serializable entities.

    called Self Tracking entities

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an interface similar to this: [ServiceContract] public interface IBaseService<T> { [OperationContract] [WebInvoke(Method
I have an service Interface: [ServiceContract] [ServiceKnownType(typeof(Models.ArticleImage))] public interface IPhotoManagementService { [OperationContract] bool Login(string
First, here's my service contract: [ServiceContract] public interface IUpdateService { [OperationContract] IEnumerable<SoftwareUpdate> GetUpdates(string version);
WCF Service INTERFACE : [ServiceContract] public interface ITest { [OperationContract] int TestCall(GenericType<MyType> x); [OperationContract]
I have a service with multiple contracts like so. [ServiceContract] public partial interface IBusinessFunctionDAO
as in the title, i have: [ServiceContract] public interface IService { [OperationContract] [WebGet(UriTemplate=abc)] Stream
Given a contract such as: [ServiceContract] public interface IService { [OperationContract] [WebGet(UriTemplate = GetData/{id}.{format})]
The case is: [ServiceContract] public interface IInfo { [DataMember] int Id{get;set;} } [DataContract] [KnownType(typeof(Legal))]
I defined a WCF implementation of REST service: enter code here [ServiceContract] public interface
I have a WCF service and methods are exposed as below: public interface IService

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.