[英]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.