フォローインエラーが発生しました。何が問題なのですか。
EndpointDispatcherでのContractFilterの不一致が原因で、アクション''を含むメッセージを受信者で処理できません。これは、コントラクトの不一致(送信者と受信者の間のアクションの不一致)または送信者と受信者の間のバインディング/セキュリティの不一致が原因である可能性があります。送信者と受信者が同じコントラクトと同じバインディング(メッセージ、トランスポート、なしなどのセキュリティ要件を含む)を持っていることを確認します。
WSModules.svc
<%@ ServiceHost language="C#" Service="WS.Modules.ServiceContracts.WSModules"%>
WSModules
namespace WS.Modules.ServiceContracts { [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] public class WSModules : IWSModules { public string XmlData(string id) { return "You requested product" + id; } } }
IWSModules
namespace WS.Interfaces.ServiceContracts { [ServiceContract] public interface IWSModules { [OperationContract] [WebGet(UriTemplate = "XmlData?id={id}")] string XmlData(string id); } }
Web.config
<system.serviceModel> <behaviors> <serviceBehaviors> <!-- ### WSModules --> <behavior name="WSModulesBehavior"> <serviceMetadata httpGetEnabled="True" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceThrottling maxConcurrentCalls="24" maxConcurrentSessions="24" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="web"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> <services> <!-- ### WSModules Service--> <service behaviorConfiguration="WSModulesBehavior" name="WS.Modules.ServiceContracts.WSModules"> <endpoint address="" binding="webHttpBinding" contract="WS.Interfaces.ServiceContracts.IWSModules"/> <host> <baseAddresses> <add baseAddress="http://xxx.xxx.xxx/commonwebsol/wswsdl" /> </baseAddresses> </host> </service> </services> <serviceHostingEnvironment multipleSiteBindingsEnabled="True"/> </system.serviceModel>
探索ブラウザを開いて http://xxx.xxx.xxx/commonwebsol/WSWSDL/WSModules.svcと入力しました-正常に動作します。「svcutil.exehttp://xxx.xxx.xxx/commonwebsol/WSWSDL/WSModules.svc?wsdl」を取得し、 「http://xxx.xxx.xxx/commonwebsol/WSWSDL/WSModules.svc ? wsdl "xmlを取得しました
しかし、エクスプローラーブラウザ http://xxx.xxx.xxx/commonwebsol/WSWSDL/WSModules.svc?XmlData?id=123に入ると 、次のエラーが発生しました...
<Text xml:lang="en-US">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).</Text>