解决WCF AddressFilter不匹配中的配置错误

时间:2008-12-04 02:16:23

标签: .net xml wcf

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

由于EndpointDispatcher上的AddressFilter不匹配,无法在接收方处理带有“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服务

1 个答案:

答案 0 :(得分:31)

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