locked
error reading from the pipe: Unrecognized error 109 (0x6d) RRS feed

  • Question

  • Hi

    When I try and return an Entity Framework entity from a WCF service I receive this strange error

    "...error reading from the pipe: Unrecognized error 109 (0x6d).

     

    This is the code that does not work

    Verify_ExternalRefType_L existingItem = null;
    
    //declare our context
    using (var db = new Operational_DBEntities())
    {
        db.Configuration.LazyLoadingEnabled = false;
    
        var query = from x in db.Verify_ExternalRefType_L
                    where x.ExternalRefTypeId == externalRefTypeId
                    select x;
    
        existingItem = query.FirstOrDefault();
    }
    
    return existingItem;

    However when I do this it works.... why do I have to re-instantiate the entity like this for it to work?

    Verify_ExternalRefType_L existingItem = null;
    
    //declare our context
    using (var db = new Operational_DBEntities())
    {
        db.Configuration.LazyLoadingEnabled = false;
    
        var query = from x in db.Verify_ExternalRefType_L
                    where x.ExternalRefTypeId == externalRefTypeId
                    select x;
    
        existingItem = query.FirstOrDefault();
    }
    
    Verify_ExternalRefType_L tempItem = null;
    if (existingItem != null)
    {
        tempItem = new Verify_ExternalRefType_L
        {
            CreationDate = existingItem.CreationDate,
            ExternalRefTypeId = existingItem.ExternalRefTypeId,
            Name = existingItem.Name,
            SourceTableName = existingItem.SourceTableName,
            UpdateDate = existingItem.UpdateDate,
            UpdatedBy = existingItem.UpdatedBy
        };
    }
    
    return tempItem;


    I.W Coetzer

    Friday, January 10, 2014 6:05 AM

Answers

  • Hello Coetzer,

    How do you call the service operations method? Is it like below:

    ServiceReference2.Service1Client client = new Service1Client();
    
    Order order = client.GetFirstOrderData();

    Have a try to disable the proxy creation, set

    db.Configuration.ProxyCreationEnabled = false;

    In Entity Framework, it is enabled by default so that it will create a proxy object of the entity which is not known by client as below:

    public Order GetFirstOrderData()
    
            {
    
                Order order = null;
    
    
                using (WCFDBEntities db = new WCFDBEntities())
    
                {
    
                    db.Configuration.LazyLoadingEnabled = false;
    
                    db.Configuration.ProxyCreationEnabled = false;
    
                    order = db.Orders.FirstOrDefault();
    
                }
    
    
                return order;
    
            }
    

    If this does not work for you, please let me know, and if it is possible, you can upload your application to skydriver.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Friday, January 24, 2014 1:22 AM
    Monday, January 13, 2014 2:28 AM

All replies

  • Hello,

    If it is possible, please share the entities so that we can do a test better.

    Regards.

    Friday, January 10, 2014 10:13 AM
  • Hi there, how do you mean share the entities?

    the edmx code, or sql table schema?

    Thank you.


    I.W Coetzer

    Saturday, January 11, 2014 4:13 PM
  • Hello Coetzer,

    How do you call the service operations method? Is it like below:

    ServiceReference2.Service1Client client = new Service1Client();
    
    Order order = client.GetFirstOrderData();

    Have a try to disable the proxy creation, set

    db.Configuration.ProxyCreationEnabled = false;

    In Entity Framework, it is enabled by default so that it will create a proxy object of the entity which is not known by client as below:

    public Order GetFirstOrderData()
    
            {
    
                Order order = null;
    
    
                using (WCFDBEntities db = new WCFDBEntities())
    
                {
    
                    db.Configuration.LazyLoadingEnabled = false;
    
                    db.Configuration.ProxyCreationEnabled = false;
    
                    order = db.Orders.FirstOrDefault();
    
                }
    
    
                return order;
    
            }
    

    If this does not work for you, please let me know, and if it is possible, you can upload your application to skydriver.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Friday, January 24, 2014 1:22 AM
    Monday, January 13, 2014 2:28 AM
  • Hi

    I will try this when I am at my development machine again and let you know if it worked.

    Thanks,

    Ian


    I.W Coetzer

    Wednesday, January 15, 2014 8:52 PM
  • Hi

    Okay, that managed to work...

    db.Configuration.LazyLoadingEnabled = false;
    db.Configuration.ProxyCreationEnabled = false;
    
    item = db.Verify_Detail_D.Where(x => x.VerifyDetailId == detailId).FirstOrDefault();

    However now I am trying to 'Include' two related types - which when I debug the code works as they are not null, however I get the same error 109 when I try and include related entities in this manner ... any ideas?

    db.Configuration.LazyLoadingEnabled = false;
    db.Configuration.ProxyCreationEnabled = false;
    
    item = db.Verify_Detail_D.Include("Verify_Type_L").Include("Verify_ExternalRefType_L").Where(x => x.VerifyDetailId == detailId).FirstOrDefault();


    I.W Coetzer

    Saturday, January 18, 2014 10:07 AM
  • Hello,

    >>Include("Verify_ExternalRefType_L").Where(x => x.VerifyDetailId == detailId).FirstOrDefault();

    A way like this to load related entities in WCF is not supported. If you want to load related entities with a remote service, then I suggest you using WCF Data Service. It completely supports all operations for Entity Framework, for details, please refer to link below:

    http://msdn.microsoft.com/en-us/library/cc668792(v=vs.110).aspx


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 20, 2014 6:13 AM