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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:05:24+00:00 2026-06-17T14:05:24+00:00

I just started a new Silverlight project with Visual Studio Express 2012 for Web.

  • 0

I just started a new Silverlight project with Visual Studio Express 2012 for Web.

I created a Silverlight-enabled WCF service to access a SQL Server database, with EF 5.

The problem I’m having is that the service doesn’t seem to be able to return any entity retrieved from the database. A new entity or any old object is returned just fine, but when I try to return an entity from the context I get the following exception:

{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. --->      System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException:  The remote server returned an error: NotFound.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassa.<EndGetResponse>b__9(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
   at NewProj.DataSvcRef.DataServiceClient.DataServiceClientChannel.EndGetAgency(IAsyncResult result)
   at NewProj.DataSvcRef.DataServiceClient.NewProj.DataSvcRef.DataService.EndGetAgency(IAsyncResult result)
   at NewProj.DataSvcRef.DataServiceClient.OnEndGetAgency(IAsyncResult result)
   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}

The service method code couldn’t be simpler:

[OperationContract]
public Contact GetContact(int aID)
{
  Contact res = null;
  using (var db = new OFBEntities())
  {
    try
    {
      res = db.Contacts.Find(aID);
    }
    catch (Exception ex)
    {
      res = null;
    }

    return res;
  }
}

As I mentioned, if I return a newly created object (return new Contact(){ name=”test contact};), or return a type that is not in context (say an integer for example), everything works fine.

Is this a limitation of the express version, or am I forgetting some settings? In the past I have created some Silverlight apps that consumed data services with VS 2010, Silverlight 4, and I don’t remember having to set anything special, but maybe I just forgot that I did?

Any help is appreciated!

EDIT:
Could it have anything to do with DbContext and the way it is serialized? I’ve never used DbContext before, I always used the default ObjectContext in EF 4…

EDIT2: SOLUTION
It’s been a while, but I had other things to work :o)
In case anybody is in the same boat, the problem was in the serialization by the service. DbContext by default creates proxies, which don’t agree with serialization. I am not sure why yet – indeed, I need to educate myself about those proxies – but disabling them solves my serialization issue.
Thanks for the comment Pawel, I mistakenly thought my serialization was going OK, rechecking the server-side error put me back on the right track.

  • 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-06-17T14:05:24+00:00Added an answer on June 17, 2026 at 2:05 pm

    The problem was with automatic proxy creation by the DBContext, which interfered with the serialization.
    Proxies are on by default in DBContext, you can disable them in the class constructor

      this.Configuration.ProxyCreationEnabled = false;
    

    or after creating an instance of your DBContext

      using (var db = new myDBContext())
      {
        db.Configuration.ProxyCreationEnabled = false;
    
        ...
      }
    

    Not sure why yet, but it works. Time to go read up on that!

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

Sidebar

Related Questions

Hi all I've just started a new project using Visual Web Developer 2008 Express
We have just started our new assignment - web-based project. Before I get directly
We just started a new ASP.Net project that uses web services to serialize some
I have just started a new project, and I am using the Delphi 2009
I've just started a brand new rails project and the first task I'm trying
i started off with a new silverlight 4 project in a seperate solution while
I just started a new project which has previously been developed in Eclipse. I
I JUST started a new XCode Project. The code I have added in so
I just started a new GWT project for a client and I'm interested in
I have just started a new project using a Linq to Sql model and

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.