Back to list
Views:   17.2K
Replies:  0

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:

        <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"
         <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" />
       <endpoint address="http://localhost:54858/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
        name="BasicHttpBinding_IMyService" />

Dan Moon, Feb 18, 2011
I turned on tracing and was able to find the issue.
Feb 18, 2011

Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.3.0