我創建了一個添加了兩個整數的簡單WCF服務。服務主機完美啓動。但在客戶端,我得到以下編譯錯誤Reference.cs
:從客戶端訪問WCF服務時出錯
The type name 'ServiceReference1' does not exist in the type 'WcfServiceClient.ServiceReference1.WcfServiceClient'
客戶端代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WcfServiceClient
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ServiceReference1.WcfServiceClient client = new ServiceReference1.WcfServiceClient("BasicHttpBinding_IWcfService");
int result = client.Add(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text));
Label1.Text = result.ToString();
}
}
}
更新參考 – Sajeetharan
@Sajeetharan更新了幾次。它正在更新。仍然出現錯誤 – Mangrio
您提供的參考名稱是什麼? – Sajeetharan