//WIN FORM客户端代码:
private System.ComponentModel.Container components = null;
private IFaxBusiness faxBus = null;
[STAThread]
static void Main() 
{
Application.Run(new ClientForm());
} private void ClientForm_Load(object sender, System.EventArgs e)
{
HttpChannel channel = new HttpChannel(0);
ChannelServices.RegisterChannel(channel); faxBus = (IFaxBusiness)Activator.GetObject(typeof(IFaxBusiness),
"http://localhost:8080/FaxBusiness.soap");
} private void btnSend_Click(object sender, System.EventArgs e)
{
if (txtFax.Text != String.Empty)
{
string fax = "来自" + GetIpAddress() + "客户端的传真:" + System.Environment.NewLine;
fax += txtFax.Text;
faxBus.SendFax(fax);
}
else
{
MessageBox.Show("请输入传真内容!");
}
} private string GetIpAddress()
{
IPHostEntry ipHE = Dns.GetHostByName(Dns.GetHostName());
return ipHE.AddressList[0].ToString();
}//========================================================//WEB FORM 代码:private IFaxBusiness faxBus = null;
private void Page_Load(object sender, System.EventArgs e)
{
HttpChannel channel = new HttpChannel(0);
ChannelServices.RegisterChannel(channel); faxBus = (IFaxBusiness)Activator.GetObject(typeof(IFaxBusiness),
"http://localhost:8080/FaxBusiness.soap");
} private void Button2_Click(object sender, System.EventArgs e)
{

if (txtFax.Text != String.Empty)
{
string fax = "来自" + GetIpAddress() + "客户端的传真:" + System.Environment.NewLine;
fax += txtFax.Text;
faxBus.SendFax(fax);
}
else
{
Response.Write("请输入传真内容!");
}
}
private string GetIpAddress()
{
IPHostEntry ipHE = Dns.GetHostByName(Dns.GetHostName());
return ipHE.AddressList[0].ToString();
}//=========================================================//系统抛的错误//说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代//码中导致错误的出处的详细信息。 //异常详细信息: System.Runtime.Remoting.RemotingException: 信道 http 已注册。//==============================================================//我的疑问:相同的客户端,代码也相同为什么在webform不可以执行呢?