[英]Error (There was no endpoint listening at) while consuming the WCF SOAP Service from Asp.net Application
早上好,
当我尝试从机器 A 中的 Asp.net 访问 WCF SOAP 服务时,出现以下错误,而当我尝试使用 SOAP UI 工具从同一台机器 A 测试相同的服务时,服务会按预期提供响应。 我有机会与服务团队会面,即使他们的代码也不起作用。 我的错误和代码如下所示,最近几天我一直在努力解决这个问题,并且还浏览了许多文章和帖子,但没有运气。 错误: https ://abc.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance 上没有可以接受消息的端点侦听。 这通常是由不正确的地址或 SOAP 操作引起的。 有关更多详细信息,请参阅 InnerException(如果存在)。
内部异常:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立连接失败 212.12.180.147:443
我确定这不是连接或 IP 地址或防火墙问题,因为使用 SOAP UI 工具,我从同一台机器获得了预期的响应。 下面是我的代码。 请帮助我在这里缺少的东西。
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;
}
添加服务引用后,在 web.config 中自动创建的条目如下。
<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>
检查这篇文章没有端点侦听http //可以接受WCF中的消息
问题可能在 web.config 中的端点
尝试更换: https : //webservice.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance
与: https : //webservice.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance/webservice.redf.gov.sa/RedfFinance.Finance.svc/RedfFinance
或: https : //webservice.redf.gov.sa/RedfFinance.Finance.svc/webservice.redf.gov.sa/RedfFinance.Finance.svc
终于经过这么多天的斗争,它奏效了。服务器不允许直接调用。 所以我们必须显式代理。 请参阅此线程以获取更多信息.. https://forums.asp.net/t/2162245.aspx?There+was+no+endpoint+listening+at+https+ABC+redf+gov+sa+RedfFinance+Finance +svc+RedfFinance+that+could+accept+the+message+
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.