WCF unable to read data from transport connection
I'm having troubles开发者_开发百科 with my WCF application. When i run the client application and it tries to connect to the server i get the following exception:
unable to read data from the transport connection an existing connection was forcibly closed by the remote host.
when i debug from the system where the service is hosted the application runs fine. When i tried to debug it from an other pc i get this error. from this other PC i can open the WSDL file (of the server application) in the browser so the server can be found.
I agree with user1039947 - absolutely enable end-to-end tracing, because that error message ends up meaning roughly eight thousand different issues, none of which have much to do with (on the surface, at least) the connection being closed.
That being said, once you view the trace, or if for some reason you are unable to enable tracing (but this is your service, so I imagine you can), the culprits I see most often are:
- Binding mismatch
- Using an interface or abstract type in your data contract
- Not using data attributes on your properties and classes when they inherit from an interface or abstract class.
At least you know you're hitting the server. If you can't get the tracing logs, and none of those are the issue, you also could always open two instances of Visual Studio, start a new debugging session of the service host in one, then connect to it from a debugging session of the client in the other. Then you can track down where in the processing the exception is getting thrown. Very often it's in the data serialization (i.e., #2 and #3).
精彩评论