简体   繁体   English

WCF在随机调用中获取“在接收到HTTP响应时发生错误”

[英]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. 我从客户端调用SOAP API时, 随机接收(并非总是) “接收到HTTP响应出错” It does not happen every time. 它不会每次都发生。 My application itself is a WCF service. 我的应用程序本身是一个WCF服务。

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" 编辑在本地环境中,它配置如下: 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. 这通常是由错误的地址或SOAP操作引起的。 See InnerException, if present, for more details. 有关更多详细信息,请参阅InnerException(如果存在)。

"An error occurred while receiving the HTTP response .." This error can occur when there something breaks in your service code. “接收HTTP响应时发生错误..”当您的服务代码中出现中断时,可能会发生此错误。

Recheck the service code. 重新检查服务代码。

Try enabling svclog in client and server. 尝试在客户端和服务器中启用svclog。 The trace log can give some idea 跟踪日志可以提供一些想法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM