Need help guys! We have existing old system ASP.NET with WCF and Microsoft enterprise library and I'm new in WCF. They have a system generated Service Model like this
Interface System generated:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName = "IMyService")]
public interface IMyService
Class:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public partial class MyService : IMyService
Then they asked me to add a method under interface and class like this
Added method in interface:
[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);
}
Added method in class:
Public void DoWork(int param1,int param2)
And then when I'm trying to call the method like this:
IMyService.DoWork(1,2)
It shows like this:
System.ServiceModel.ActionNotSupportedException: 'The message with Action ' http://tempuri.org/IMyService/DoWork ' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, eg Message, Transport, None).'
Am I missing something?
Today I ended up with the same error and doing below workaround solved issue for me.
At client-side application, Removing existing WCF service reference and adding it again solved the issue for me.
However, first, you may also need to verify that the hosting application service contract address and client endpoint address contract are the same.
ie Host configuration.
Client configuration
I created new service by copying existing one and forgot to rename 'Service' attribute in this .svc file.
I received following error: System.ServiceModel.ActionNotSupportedException: The message with Action 'http://tempuri.org/...' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, eg Message, Transport, None).
Issue was resolved once I set 'Service' attribute correctly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.