任何想法我如何纠正这个...通过js调用服务
由于EndpointDispatcher上的AddressFilter不匹配,无法在接收方处理带有"http://MySite.svc/GetStateXML"的消息.检查发送方和接收方的EndpointAddresses是否一致
谢谢
我正在使用启用了Ajax的WCF,当我在网络浏览器中打开网址时,我收到此错误.
由于EndpointDispatcher上的ContractFilter不匹配,因此无法在接收方处理具有Action'http:// localhost:22219/MobileService.svc/GetProductCategories ' 的消息.这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配.检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无).
MobileService代码如下
namespace MobileService
{
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MobileService
{
// To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
// To create an operation that returns XML,
// add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
// and include the following line in the operation body:
// WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
[OperationContract]
public void DoWork()
{
// Add your operation implementation here
return;
}
[OperationContract]
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, …Run Code Online (Sandbox Code Playgroud)