![](/img/trans.png)
[英]WCF- ContractFilter mismatch at the EndpointDispatcher
[英]WCF ContractFilter mismatch at the EndpointDispatcher error
需要帮助的家伙! 我们现有带有 WCF 和 Microsoft 企业库的旧系统 ASP.NET,我是 WCF 的新手。 他们有一个像这样的系统生成的服务模型
接口系统生成:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IMyService")]
public interface IMyService
班级:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public partial class MyService : IMyService
然后他们让我在接口和类下添加一个这样的方法
在接口中添加方法:
[System.ServiceModel.OperationContractAttribute (Action = "http://tempuri.org/IMyService/DoWork", ReplyAction = "http://tempuri.org/IMyService /DoWorkReponse")]
void DoWork (int param1,int param2);
public void DoWork (int param1,int param2)
{
base.Channel.DoWork (int param1,int param2);
}
在类中添加方法:
Public void DoWork(int param1,int param2)
然后当我尝试像这样调用方法时:
IMyService.DoWork(1,2)
它显示如下:
System.ServiceModel.ActionNotSupportedException: 由于 EndpointDispatcher 的 ContractFilter 不匹配,因此无法在接收方处理带有 Action ' http://tempuri.org/IMyService/DoWork的消息。 这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。 检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
我错过了什么吗?
我通过复制现有服务创建了新服务,但忘记重命名此 .svc 文件中的“服务”属性。
我收到以下错误: System.ServiceModel.ActionNotSupportedException:由于 EndpointDispatcher 的 ContractFilter 不匹配,无法在接收方处理带有 Action 'http://tempuri.org/...' 的消息。 这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。 检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
一旦我正确设置了“服务”属性,问题就解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.