Consuming WCF Error: There was no endpoint listening at that could accept the message

Last Reply 5 months ago By dharmendr

Posted 5 months ago

Hi,

I can able to add service reference of SOAP service, able to see what type of parameters and how many parameters all their methods expects.  But when I run the application, I am getting below exception.

There was no endpoint listening at https://abc.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

inner exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 212.12.180.147:443

I am sure it is not connection or IP address or firewall issue, because using SOAP UI tool, I am getting the response as expected from this same machine. Below is my code.

Kindly help what I am missing here.

using Consume_REDF_FourTimesAuth.ServiceReference1;
try
{
    FinanceClient objFinanceClient = new FinanceClient("WSHttpBinding_IFinance");
    System.Net.ServicePointManager.ServerCertificateValidationCallback = ((se, certificate, chain, sslPolicyErrors) => true);
    objFinanceClient.ClientCredentials.UserName.UserName = "abc";
    objFinanceClient.ClientCredentials.UserName.Password = "13456";
    Credential objCredentials = new Credential();
    objCredentials.UserName = "xyz";
    objCredentials.Password = "123456";

    var Response = objFinanceClient.getRealEstateRegions(objCredentials);
    //var Response = objFinanceClient.getCalculaterV2(objCredentials, 123456, 22.2, 11.1, 12, 202, 24, 06, "10/06/1987", 
    //                                                2, "02/11/2019", 22.2, 2, 2, 22.2, 2, 22.2);
    lblDisplay.Text = Response.ToString();
}
catch (Exception ex)
{
    throw ex;
}

Entries made automatically in web.config after adding service reference.

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IFinance">
          <security mode="Transport">
            <transport clientCredentialType="Basic" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://webservice.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFinance"
        contract="ServiceReference1.IFinance" name="WSHttpBinding_IFinance">
        <identity>
          <dns value="webservice.redf.gov.sa" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

 

Posted 5 months ago Modified on 5 months ago