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 7074175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:01:11+00:00 2026-05-28T06:01:11+00:00

When I run my service I got exception: The server encountered an error processing

  • 0

When I run my service I got exception:

The server encountered an error processing the request. The exception message is ‘Cannot serialize parameter of type System.Data.Entity.DynamicProxies.Cosik_14C2…’ (for operation ‘GetCosik’, contract ‘ICosikService’) because it is not the exact type ‘Project.Domain.Entities.Cosik’ in the method signature and is not in the known types collection. In order to serialize the parameter, add the type to the known types collection for the operation using ServiceKnownTypeAttribute.’. See server logs for more details.

I’m new to WCF services and Entity Framework and I’d appreciate any help/suggestions.

I’m using Entity Framework 4.1. Using code-first I created database with two tables:

[DataContract(IsReference=true)]
public class Cosik
{
    [DataMember]
    public int cosikID { get; set; }

    [DataMember]
    public string title { get; set; }

    [DataMember]
    public int DifficultyID { get; set; }
    [DataMember]
    public virtual Difficulty Difficulty { get; set; }
}

[DataContract(IsReference=true)]
public class Difficulty
{
    [DataMember]
    public int DifficultyID { get; set; }

    [DataMember]
    [Required]
    public string NameToDisplay { get; set; }
}

Next I created the WCF service application and made it RESTful. Below is code for interface:

[ServiceContract]
public interface ICosikService
{
    [OperationContract]
    [ApplyDataContractResolver]
    [WebGet(UriTemplate = "/cosik")]
    Cosik GetCosik();
}

and implementation of that contract

public class RecipeService : IRecipeService
{
//repository of Cosik entities - stores collection of all
//Cosik entities that can be queried from DB
private ICosikRepository cosikRepo;
...

public Cosik GetCosik()
    {
        Cosik c = cosikRepo.GetById(1);
        return c;
    }

I implemented ApplyDataContractResolverAttribute class given on: http://msdn.microsoft.com/en-us/library/ee705457.aspx and added [ApplyDataContractResolver] annotation to GetCosik method. However, it didn’t help.

Any suggestion what I’ve missed?

  • 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-28T06:01:11+00:00Added an answer on May 28, 2026 at 6:01 am

    Instead of developing custom resolver turn off proxy creation. Proxies are not for scenarios like WCF because lazy loading must be turned off anyway during serialization and dynamic change tracking is never used:

    context.Configuration.ProxyCreationEnabled = false;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following stacktrace [15/12/11 05:52:01:001 EET] WARN EXCEPTION @7361b0bc=POST//xxx.xxx.xxx.xxx:xxxx/service/receiveMessage?nodeType=server&messageType=generatePoster&callerId=null&messageId=21c1f0e4-8ffe-4c4e-ade0-2b475c029203#WAITING(31811ms)->EXCEPTED(1ms)sent=31813ms java.lang.NullPointerException at org.eclipse.jetty.http.HttpGenerator.prepareBuffers(HttpGenerator.java:1045)
After deploying an ASP.net webservice to my production server i got this exception: System.MissingMethodException
We've got a scheduling application running that calls a WCF service to run nightly
I'm getting a 404 error when trying to run another web service on an
I want to run function inside web service (.asmx file) $.ajax({ type: POST, contentType:
I've got a problem with System.Windows.Forms.WebBrowser On every machine, with the exception of one,
I've got service/application connected to mssql server, and it sometimes crashes terribly with following
I am writing a C# Window service to be run on a Server (installed
Got these error while trying to run my first Java webservice tutorial in Eclipse.
we run a WCF service hosted in IIS7 on Win2k8. We see the following

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.