0

WCFサービスにカスタムエンドポイント/操作拡張機能を実装しようとしています。websconfigにカスタム拡張機能を接続して、サービスと操作を属性で装飾できるようにしました。ただし、そうすると、次のエラーが発生します。

To'http:// localhost:1605 / Graph.svc / Triples / vbid / akb9185 / 0 / en-us'のメッセージは、EndpointDispatcherでのAddressFilterの不一致により、受信側で処理できません。送信者と受信者のEndpointAddressesが一致していることを確認します。

私は多くの検索を行いましたが、このエラーが何を意味するのか、またはそれを修正する方法を理解できません。誰かが助けることができますか?

これは、エンドポイントと操作の動作を「注入」しているサービスです。

<service name="Services.Graph" behaviorConfiguration="Services.DefaultBehavior">
    <endpoint address="" binding="webHttpBinding" contract="Services.IGraphService" behaviorConfiguration="corsMessageInspection"
 bindingConfiguration="LargeMessageBinding" bindingNamespace="http://icp.myorg.org">
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

エンドポイントとサービスの動作の構成は次のとおりです。

<endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>        
    <behavior name="corsMessageInspection">
      <endpointMessageInspector />
    </behavior>        
  </endpointBehaviors>

  <serviceBehaviors>
    <behavior name="Services.DefaultBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />          
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>

カスタムエンドポイント/操作拡張機能の構成は次のとおりです。

<extensions>
  <behaviorExtensions>
    <add name="endpointMessageInspector" type="org.myorg.wcf.cors.CorsEndPointExtensionElement, org.myorg.wcf.cors, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  </behaviorExtensions>
</extensions>

そして最後に、私のサービス契約がどのように見えるかの例を示します。

 [ServiceContract(Namespace = "http://icp.myorg.org")]
[CorsBehavior]
public interface IGraphService
{
    [OperationContract]
    [CorsBehavior]
    [WebInvoke(Method = "*", UriTemplate = "Triples/{library}/{subjectLocalPart}/{depth}/{languageCode}")]
    GraphNode ReadTriple(string library, string subjectLocalPart, string depth, string languageCode);

「CorsBehavior」は、IEndPointBehaviorとIOperationBehaviorの両方を実装するカスタム属性です。

4

1 に答える 1

0

属性を尊重する場合[WebInvoke]は、WebHttpBehavior ( <webHttp/>) をエンドポイントの動作にも追加する必要があります。エンドポイント (corsMessageInspection) によって参照される動作を変更して、webHttp 動作とカスタム動作の両方を持つようにします。

<endpointBehaviors>
  <behavior name="corsMessageInspection">
    <webHttp />
    <endpointMessageInspector />
  </behavior>
</endpointBehaviors>
于 2012-01-05T20:35:00.673 に答える