在我的項目中,我必須從WCF服務調用Web服務(.net)。我在做同樣的事情時遇到了一些運行時錯誤,請告訴我如何實現同樣的目的,以便我可以檢查,我的方法中缺少什麼。來自WCF的Web服務
嗨,
在WCF的代碼如下所示(示例代碼)
public int AddWCF(int a, int b)
{
proxy_http.CalculatorSoapClient ad = new proxy_http.CalculatorSoapClient("CalculatorSoap");
int ab = ad.Add(a,b);
return ab;
}
在Web服務的一個看起來是這樣的: -
public Calculator() {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod(Description = "This method can be used to Add 2 integers", MessageName = "AddMethod")]
public int Add(int num1, int num2)
{
return num1 + num2;
}
[WebMethod(Description = "This method can be used to Subtract 2 integers", MessageName = "SubtractMethod")]
public int Subtract(int num1, int num2)
{
return num1 - num2;
}
中出現的錯誤只給予創建Web服務的實例WCF部分,以下錯誤,當
「無法˚F在ServiceModel客戶端配置部分中名爲'CalculatorSoap'和合約'proxy_http.CalculatorSoap'的ind端點元素。這可能是因爲沒有配置文件找到您的應用程序,或者是因爲匹配該名稱的端點元素可以在客戶端元素中找到。」
你能詳細說明你是如何做的嗎?發佈一些代碼,詳細瞭解您所看到的錯誤。 – InSane 2010-12-03 09:49:23