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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:25:24+00:00 2026-05-26T19:25:24+00:00

I am using SQL Azure as database with code first technique of Entity framework

  • 0

I am using SQL Azure as database with code first technique of Entity framework 4.1. I’m accessing EF from WCF as middle tier and providing the service reference to ASP.NET MVC 3.

The relational scenario in EF is A->B->C so as usual I tried to get A including B including C with few possibilities:

db.A.Include("B").Include("B.C")
db.A.Include("B").Include("C")

But in the Service itself running perfect. Since adding the reference to the web application it attempts to serialize and throws the exception below. I tried to make true-false lazy loading also without success.

"The underlying connection was closed: The connection was closed unexpectedly"
Stack Trace found:
 at System.Net.HttpWebRequest.GetResponse() at
 System.ServiceModel.Channels.HttpChannelFactory.
     HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

I visited this page to resolve, and added the suggested attributes in web.config. Now I’m suddenly getting error:

The server did not provide a meaningful reply; this might be caused by
a contract mismatch, a premature session shutdown or an internal
server error

I thought it might be issue of some tag/atrribute mismatch in client and service web.configs but everything is right there. One thing I could not get to passing the List of objects with loading of its entire cllection properties, from wcf service to web application is found very heavy and low in performance. still facing the above issues to get the loaded list at web application in above explained architecture. can some body help here….

  • 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-26T19:25:25+00:00Added an answer on May 26, 2026 at 7:25 pm

    hey Thanks Kirk Broadhurst
    , By this I could track the Issue. and searche around it. I got the solution. I added this class in my project

    public class ReferencePreservingDataContractFormatAttribute : Attribute, IOperationBehavior
            {
                #region IOperationBehavior Members
                public void AddBindingParameters(OperationDescription description, BindingParameterCollection parameters)
                {
                }
    
                public void ApplyClientBehavior(OperationDescription description, System.ServiceModel.Dispatcher.ClientOperation proxy)
                {
                    IOperationBehavior innerBehavior = new ReferencePreservingDataContractSerializerOperationBehavior(description);
                    innerBehavior.ApplyClientBehavior(description, proxy);
                }
    
                public void ApplyDispatchBehavior(OperationDescription description, System.ServiceModel.Dispatcher.DispatchOperation dispatch)
                {
                    IOperationBehavior innerBehavior = new ReferencePreservingDataContractSerializerOperationBehavior(description);
                    innerBehavior.ApplyDispatchBehavior(description, dispatch);
                }
    
    
                public void Validate(OperationDescription description)
                {
                }
                #endregion
            }
    
            class ReferencePreservingDataContractSerializerOperationBehavior : DataContractSerializerOperationBehavior
            {
                public ReferencePreservingDataContractSerializerOperationBehavior(OperationDescription operationDescription) : base(operationDescription) { }
                public override XmlObjectSerializer CreateSerializer(Type type, string name, string ns, IList<Type> knownTypes)
                {
                    return CreateDataContractSerializer(type, name, ns, knownTypes);
                }
    
                private static XmlObjectSerializer CreateDataContractSerializer(Type type, string name, string ns, IList<Type> knownTypes)
                {
                    return CreateDataContractSerializer(type, name, ns, knownTypes);
                }
    
                public override XmlObjectSerializer CreateSerializer(Type type, XmlDictionaryString name, XmlDictionaryString ns, IList<Type> knownTypes)
                {
                    return new DataContractSerializer(type, name, ns, knownTypes,
                    0x7FFF /*maxItemsInObjectGraph*/,
                    true/*ignoreExtensionDataObject*/,
                    true/*preserveObjectReferences*/,
                    null/*dataContractSurrogate*/);
                }
            }
        }
    

    And Added just : [ReferencePreservingDataContractFormat] as an attribute with the method definition where i wanted to use the “Include”. thats it worked for me.
    This might be helpful for other needy people.

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

Sidebar

Related Questions

Does anyone have any good sources of information of using NHibernate with Sql Azure
I'm comparing Entity Framework with NHibernate, and I'd like to know if when using
At the MSDN website it says, Connecting to SQL Azure by using OLE DB
I am looking at using SQL Azure and wondering if it supports the FILESTREAM
For everyone playing with SQL Azure, what are you using for reporting? Do the
I have created a database with SQL Azure and everything works fine except for
Using SQL Plus, you can run a script with the @ operator from the
I'm in ASP.NET MVC and am (mostly) using Entity Framework. I want to call
I am working with Azure Table storage using the .NET API (TableServiceContext, WCF Data
I've recently migrated a couple of SQL 2008 databases to Azure using the 3.7

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.