Views: 17.2K
Replies: 0
Archived
|
WCF Service Exception: "Underlying connection was closed"I'm trying to recreate something similiar to the example in Patterns In Action 4.0 ActionService.cs except it is much simpler I only have 1 method in my WCF service. The problem I'm experiencing is that anytime there is a failure the response isn't returned to the client but an System.ServiceModel.CommunicationException "the underlying connection was closed: the connection closed unexpectedly" occurs. How do I get the response to get returned instead of an exception?
WCF service.cs public EntryResponse SetEntry(EntryRequest request) { var response = new EntryResponse(request.RequestId); response.Acknowledge = AcknowledgeType.Failure; response.Message = "testing fault message"; return response; } And the ASP.NET web.config: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IMyService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:54858/MyService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService" contract="MyServiceServiceReference.IMyService" name="BasicHttpBinding_IMyService" /> </client> </system.serviceModel> Dan Moon, Feb 18, 2011
I turned on tracing and was able to find the issue.
http://tbszone.com/post/2010/11/16/WCF-The-connection-was-closed-unexpectedly.aspx
Feb 18, 2011
|