Exception while calling an ASP.NET Web Service using WCF
I have a WCF client which calls an ASP.NET web service in a different proj开发者_开发问答ect. 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
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.
精彩评论