Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Getting "An error occurred while receiving the HTTP response to.." on random call

I am receiving randomly (Not always) "An error occurred while receiving the HTTP response to.." when calling SOAP API from client. It does not happen every time. My application itself is a WCF service.

Client Config:

<binding name="AbcBinding" 
                 sendTimeout="00:02:45"
                 closeTimeout="00:02:45"
                 openTimeout="00:02:45"
                 receiveTimeout="00:10:00"
                 bypassProxyOnLocal="false"
                 maxBufferPoolSize="2147483647" 
                 maxReceivedMessageSize="2147483647">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
                <security mode="Transport" >
                <transport clientCredentialType="Basic" />
                </security>
        </binding>

<client>
      <endpoint binding="basicHttpBinding" bindingConfiguration="AbcBinding"
                contract="AbcContract" name="AbcBinding" />
    </client>

Code:

var configFactory = new ConfigurationChannelFactory<AbcContract>("AbcBinding"), ConfigFile, "localhost:9198/AbcCall");

            #region Basic http authentication
            if (configFactory.Credentials != null)
            {
                    var defaultCredentials = configFactory.Endpoint.Behaviors.Find<ClientCredentials>();
                    configFactory.Endpoint.Behaviors.Remove(defaultCredentials);

                    var loginCredentials = new ClientCredentials();
                    loginCredentials.UserName.UserName = "UserName";
                    loginCredentials.UserName.Password = "Password";
                    configFactory.Endpoint.Behaviors.Add(loginCredentials);

            }

EDIT On local environment, it is working fine with following configuration: useDefaultWebProxy="false" proxyAddress="http://127.0.0.1:8888"

But on deployment server I am getting following error with above configuration:

There was no endpoint listening at ... that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

like image 286
FaizanHussainRabbani Avatar asked Nov 08 '22 01:11

FaizanHussainRabbani


1 Answers

"An error occurred while receiving the HTTP response .." This error can occur when there something breaks in your service code.

Recheck the service code.

Try enabling svclog in client and server. The trace log can give some idea

like image 189
Ajith Avatar answered Nov 14 '22 22:11

Ajith