WCF: The underlying connection was closed. The connection was closed unexpectedly

When I was playing with WCF and consuming my first WCF service, I got an error like this "The underlying connection was closed. The connection was closed unexpectedly". The error message is not in very detail and so it is bit hard to guess the actual error in first glance. After doing some research, I have found out that the problem in fact in the serialization. There was a field in the datacontract of being System.Type which you cannot serialize.

Hope this helps.

Comments

Unknown said…
Oh my God. Great post. Thanks man it saved my day.