CommunicationException in WCF

Posted by user343159 on Stack Overflow See other posts from Stack Overflow or by user343159
Published on 2010-05-19T16:02:24Z Indexed on 2010/05/19 16:30 UTC
Read the original article Hit count: 335

Filed under:
|
|

Hi

I have a problem with a WCF Service I've just created. This was working yesterday but for some reason it's just stopped working.

One of my WCF methods returns an array of an Entity Framework entity, like this:

    public BranchContactDetail[] GetClosestBranches(string postcode, int howManyBranches)
    {
        GeoLocation geoLocation = GetLocationFromPostcode(postcode);
        Location location = new Location(geoLocation.Latitude, geoLocation.Longitude);

        using (BranchDirectoryEntities entities = new BranchDirectoryEntities())
        {
            var branchesInOrder = entities.BranchContactDetails
                .Where(b => b.latitude.HasValue && b.longitude.HasValue )
                .OrderBy(b => location.DistanceFrom(b.latitude, b.longitude))
                .Take(howManyBranches)
                .ToArray();

            return branchesInOrder;
        }
    }

...and, as I say, this was working fine yesterday. Now I'm getting a "The underlying connection was closed: The connection was closed unexpectedly." I've hunted all over the web but no-one seems to know the answer. Anyone shed any light on this issue?

Regards, Mark

© Stack Overflow or respective owner

Related posts about wcf

Related posts about exception