1

I have a service that I added to the my client project ,service method running correct but when return data throw this bellow exception :

An error occurred while receiving the HTTP response to http://localhost/MyProject/MyService.svc.
This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

Inner Exception: The underlying connection was closed: An unexpected error occurred on a receive.

Inner Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Inner Exception: An existing connection was forcibly closed by the remote host

Note: the return type of my service is DataTable.

Client config :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
               <binding name="BasicHttpBinding_IMyService" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647"/>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost/MyProject/MyService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
                contract="MyService.IMyService" name="BasicHttpBinding_IMyService" />
        </client>
    </system.serviceModel>
</configuration>

How to resolve this error?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mohsen
  • 231
  • 5
  • 17

0 Answers0