标准的HelloWorld为啥不行?好心人帮忙指点一下!

照着msdn copy的,总是报这个错
"该服务器提交了 HTTP 协议冲突"
好心人帮忙指点一下!
[67 byte] By [elusion-落] at [2008-6-10]
# 2
Client:
private void Button1_Click(object sender, System.EventArgs e)
{
try
{
Service1 service=new Service1();
this.Label1.Text=service.HelloWorld();
}
catch(WebException we)
{
}
}

Server:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
elusion-落 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 3
异常详细信息: System.Net.WebException: 基础连接已经关闭: 该服务器提交了 HTTP 协议冲突。//错误代码:ServerProtocolViolation
源错误:

行 41: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
行 42: public string HelloWorld() {
行 43: object[] results = this.Invoke("HelloWorld", new object [0]); //{此行错误}
行 44: return ((string)(results[0]));
行 45: }

elusion-落 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 4
估计是你没引用System.Web.WebServices的命名空间
LVOLCANO-风起 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 5
你问问大象吧,他对这个挺在行的,我不是太熟悉。
# 6
还是谢谢你的关注
elusion-落 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 7
看现象象是客户端没有找到Webservice地址。

在客户端调用WebService需要设置WebService的地址,如果你的客户端的Web引用的Url行为(在其属性中)设为静态,则客户端会根据你编辑状态下引用地址去查找Webservice,如果你的客户端的Web引用的Url行为(在其属性中)设为动态,则客户端会自动生成一个文件名与程序Exe一致的Config文件,运行时你可以改Config文件中的Webservice地址。
ibbcall at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 8
地址改成127.0.0.1 localhost 或ip都不成
为什么引用的时候测试正常呢 是不是我遗漏了啥
elusion-落 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 9
private void Button1_Click(object sender, System.EventArgs e)
{
try
{
Service1.localhost service=new Service1.localhost();///改改,看看是不是这里的问题
this.Label1.Text=service.HelloWorld();
}
catch(WebException we)
{
}
}

Server:
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
lczddd-李找乐 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...
# 10
没戏
结了算了
elusion-落 at 2007-10-27 > top of Msdn China Tech,.NET技术,Web Services...