我想在我的WCF服务中实现自定义端点/操作扩展。我已经在websconfig中连接了我的自定义扩展,这样我就可以装饰我的服务&和具有属性的操作。但是这样做后,我得到以下错误:WCF - 使用自定义端点行为时的寻址问题
The message with To 'http://localhost:1605/Graph.svc/Triples/vbid/abk9185/0/en-us' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
我已经做了很多搜索,但我想不出这是什么错误意味着或如何解决它。有人可以帮忙吗?
这是我“注入”我的端点和操作行为到服务:
<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>
最后这里是一个e xample的什么我的服务合同是这样的:
[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我的自定义属性。
Dude ..你是男人。非常感谢。 – Nick 2012-01-05 20:51:09
那个错误消息让我在一个非常不同的地方寻找。包括你的博客:) – Nick 2012-01-05 20:52:44
很高兴帮助:) – carlosfigueira 2012-01-06 01:40:52