0

我有一个 WCF 客户端,它在不同的项目中调用 ASP.NET Web 服务。我收到以下错误消息:

System.Web.Services.Protocols.SoapException:服务器无法识别 HTTP Header SOAPAction http://localhost/IMyWebService/MeMethod的值

网络服务代码

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class MyWebService : System.Web.Services.WebService, IMyWebService
{
    [WebMethod]
    public string MyMethod() {return "";}

}

public interface IMyWebService
{
   string MyMethod();
}

WCF 客户端代码:

[ServiceContract]
public interface IMyWCFService
{
    [OperationContractAttribute(Action = "http://localhost/IMyWebService/MeMethod")]
    string MyMethod();
}

有谁知道问题是什么。

谢谢

4

1 回答 1

0

我不确定这是否是拼写错误,但您在客户端使用的操作拼写为MeMethod,而服务上的方法拼写为MyMethod。

于 2010-01-14T12:12:43.640 回答