WCF - An error occurred while receiving the HTTP response to http://xxxxx/Service/

Found the root cause after a lot of swearing and thinking of how nice the weather is outside. I remove the virtual keyword from the UserDetails object that is inside the User object.

Now it works!

As far as why this caused an issue, my assumptions are serialization or DbContext issues, but I will have to look more into it, not sure.

I'm going outside now.

So for reference, if you wound up here and have no idea what is going on, among all the other things you should look at (size, timeout, etc):

Check to see if your object has virtual keyword on it.

I had this problem and in my case, the issue was the WCF service was returning a class that had a property with only a getter and no setter. I was trying to prevent the property from being modified by the receiver. To get around this, see this...

WCF Services and Object Constructors


I had the same error.

In my case I have a table with an int column called OEM. In the model layer I have a class (DTO) with that column represented by an Enum. There was a row in the table which value in OEM colum was not valid. When I was trying to bring all data using LINQ, there was an error that wasn't captured by VisualStudio. That error raised when WCF tried to retrieve the message.