现有固定协议的webService,要开发一个相应的wcf服务,客户端是固定的,发送的SoapHeader中不包含Action信息,而服务端OperationContractAttribute中只能有一个Action="",如果OperationContract中不设置Action,则会报错
{"The message with Action '' 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, e.g. Message,
Transport, None)."}
如果设置其中一个Action=""再调用这个函数,能正常运行。
但这个Service中有多个函数,服务器端要如何定义才能识别空的Action?
在具体实现上加了[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)],没起作用
在配置的behavior节点中添加<routing routeOnHeadersOnly="false" />也没起作用
------解决方案--------------------
既然是空action,干嘛还要引用,直接删了不就行了