【问题标题】:Resolving Configuration Error in WCF AddressFilter Mismatch解决 WCF AddressFilter 不匹配中的配置错误
【发布时间】:2008-12-04 02:16:23
【问题描述】:

我收到以下错误,可以使用一些帮助来解决它。有人有什么想法吗?

由于 EndpointDispatcher 中的 AddressFilter 不匹配,收件人无法处理带有 To 'http://localhost:60078/BidService.svc/Query' 的消息。检查发送方和接收方的 EndpointAddresses 是否一致。

客户端配置文件为:

<system.serviceModel>
    <bindings>
        <customBinding>
            <binding name="WebHttpBinding_IBidService">
                <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                    messageVersion="None" writeEncoding="utf-8">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" 
                                  maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                </textMessageEncoding>
                    <httpTransport manualAddressing="True" />
            </binding>
        </customBinding>
    </bindings>
    <client>
        <endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_IBidService" 
                  behaviorConfiguration="IBidServiceBehavior"
            contract="myService.IBidService" name="WebHttpBinding_IBidService" />
    </client>
        <behaviors>
            <endpointBehaviors>
                <behavior name="IBidServiceBehavior">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
        </behaviors>
</system.serviceModel>

我的服务合同是:

[ServiceContract(Namespace = "http://xxxx.com/services/bids")]
public interface IBidService
{
    [OperationContract(Action = "*")]
    [WebGet(RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
    List<BidSummary> Query();
}

我的服务配置如下:

<service name="xxx.Web.Services.Bids.BidService" 
          behaviorConfiguration="Cutter.Web.Services.Bids.BidServiceBehavior">
   <endpoint address="" binding="basicHttpBinding" 
             contract="xxx.Web.Services.Bids.IBidService" />                
   <endpoint address="mex" binding="mexHttpBinding" 
             contract="IMetadataExchange" />
</service>

<behavior name="Cutter.Web.Services.Bids.BidServiceBehavior">
   <serviceMetadata httpGetEnabled="true"  />
   <serviceDebug includeExceptionDetailInFaults="true" />
</behavior>

我读到的一件事是您需要拥有我添加的 webHttp 行为。任何帮助,将不胜感激。我只想要一个简单的 POX 服务

【问题讨论】:

    标签: .net xml wcf


    【解决方案1】:

    我认为您还需要将 webHttp 行为添加到服务配置中。

    【讨论】:

    • 我是这么认为的,但我不认为这是一个选择。它至少不会出现在智能感知中。
    • 谢谢,我不明白为什么他们有 ServiceBehaviors 和 EndpointBehaviors 但现在可以正常工作...现在让我的 wcf 客户端正常工作。
    • 一个服务可以有多个端点;一些行为的范围是整个服务,而另一些行为则针对每个端点。
    • 正确,如果你用 [WebInvoke] 装饰 ServiceContract 那么你需要在你的行为配置中声明一个 行为
    猜你喜欢
    • 2012-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多