使用 WCF 调用 ASP.NET Web 服务时出现异常
我有一个 WCF 客户端,它在另一个项目中调用 ASP.NET Web 服务。我收到以下错误消息:
System.Web.Services.Protocols.SoapException:服务器无法识别 HTTP 标头 SOAPAction 的值 http://localhost /IMyWebService/MeMethod
Web 服务代码:
[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();
}
有谁知道问题是什么。
谢谢
I have a WCF client which calls an ASP.NET web service in a different project. I get the following error message:
System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction http://localhost/IMyWebService/MeMethod
Web Service code:
[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 client code:
[ServiceContract]
public interface IMyWCFService
{
[OperationContractAttribute(Action = "http://localhost/IMyWebService/MeMethod")]
string MyMethod();
}
Does anyone know what the problem is.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否是一个拼写错误,但您在客户端中使用的操作拼写为 MeMethod,而服务上的方法拼写为 MyMethod。
I'm not sure if this is a typo or not, but the action you are using in the client is spelt MeMethod, while the method on the service is spelt MyMethod.