title: WCF Configuration AddressFilter mismatch
body: <p>I am having WCF configuration woes. I have a WCF Webservice that I want to be able to access through a web browser using GET parameters (and eventually in PHP with simplexml_load_file()). My Visual Studio Solution is set up as a WCF Service Library project containing an Interface (where the service is defined), a class (where the service is implemented, and an app.config (which was there by default). I also have a WCF Service Project which contains a .svc file (which points to my class) and a web.config. My Service Interface is designed like this:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using RTXEngineLib.externalLibrary;
  namespace RTXEngineLib {
      [ServiceContract(Name = "RTXEngine", Namespace = "")]
      public interface IRTXEngine {
          [OperationContract(Name = "GetCountryList"), WebGet(UriTemplate = "/GetCountryList/", ResponseFormat = WebMessageFormat.Xml)]
          List&lt;Country&gt; GetCountryList();
          [OperationContract(Name = "GetRegions"), WebGet(UriTemplate = "/GetRegions/?countryID={countryID}", ResponseFormat = WebMessageFormat.Xml)]
          List&lt;Region&gt; GetRegions(int countryID);
          [OperationContract(Name = "GetExchangeAvailability"), WebGet(UriTemplate = "/GetExchangeAvailability/?countryID={countryID}&amp;month={month}&amp;year={year}&amp;regionID={regionID}&amp;resortID={resortID}", ResponseFormat = WebMessageFormat.Xml)]
          AvailabilityList GetExchangeAvailability(int countryID, String month, int year, String regionID = "?", String resortID = "");
          [OperationContract(Name = "GetResortsForDate"), WebGet(UriTemplate = "/GetResortsForDate/?month={month}&amp;year={year}", ResponseFormat = WebMessageFormat.Xml)]
          List&lt;AvailabilityList&gt; GetResortsForDate(String month, int year);
          [OperationContract(Name = "GetRegionLists"), WebGet(UriTemplate = "/GetRegionLists/", ResponseFormat = WebMessageFormat.Xml)]
          List&lt;RegionList&gt; GetRegionLists();
          [OperationContract(Name = "GetRegionListCacheState"), WebGet(UriTemplate = "/GetRegionListCacheState/", ResponseFormat = WebMessageFormat.Xml)]
          Boolean GetRegionListCacheState();
      }
      [DataContract(Namespace = "")]
      public class LoginRequestResponse {
          [DataMember]
          public Boolean Success { get; set; }
          [DataMember]
          public AccountStanding AccountStanding { get; set; }
          [DataMember]
          public double FTXBalance { get; set; }
          [DataMember]
          public List&lt;User&gt; Users { get; set; }
          [DataMember]
          public List&lt;ContractData&gt; Contracts { get; set; }
      }
      [DataContract(Namespace = "")]
      public enum AccountType {
          [DataMember]
          NonAuthenticatedAccount,
          [DataMember]
          AC,
          [DataMember]
          PT,
          [DataMember]
          Wks
      }
      [DataContract(Namespace = "")]
      public enum AccountStanding {
          [DataMember]
          NotAuthenticated,
          [DataMember]
          Good,
          [DataMember]
          Mixed,
          [DataMember]
          Delinquent
      }
      [DataContract(Namespace = "")]
      public struct RegionList {
          [DataMember]
          public String CountryName { get; set; }
          [DataMember]
          public String CountryID { get; set; }
          [DataMember]
          public List&lt;Region&gt; Regions { get; set; }
      }
      [DataContract(Namespace = "")]
      public struct Country {
          [DataMember]
          public String CountryName { get; set; }
          [DataMember]
          public String ID { get; set; }
      }
      [DataContract(Namespace = "")]
      public struct Region {
          [DataMember]
          public String RegionName { get; set; }
          [DataMember]
          public String ID { get; set; }
      }
      [DataContract(Namespace = "")]
      public struct User {
          [DataMember]
          public String FirstName { get; set; }
          [DataMember]
          public String LastName { get; set; }
          [DataMember]
          public String Address { get; set; }
          [DataMember]
          public String City { get; set; }
          [DataMember]
          public String State { get; set; }
          [DataMember]
          public String Zip { get; set; }
          [DataMember]
          public String CountryOfResidence { get; set; }
          [DataMember]
          public String PhoneNumber { get; set; }
      }
      [DataContract(Namespace = "")]
      public struct ContractData {
          [DataMember]
          public String ContractID { get; set; }
          [DataMember]
          public AccountType AccountType { get; set; }
          [DataMember]
          public AccountStanding AccountStanding { get; set; }
          [DataMember]
          public String AvailablePoints { get; set; }
          [DataMember]
          public String UnavailablePoints { get; set; }
          [DataMember]
          public String Usage { get; set; }
      }
      [DataContract(Namespace = "")]
      public struct PointsData {
          [DataMember]
          public String ContractID { get; set; }
      }
      [DataContract(Namespace = "")]
      public class GlobalAppCache {
          [DataMember]
          public static DateTime RegionListsLastUpdate { get; set; }
          [DataMember]
          public static List&lt;RegionList&gt; CachedRegionLists { get; set; }
      }
  }
  </code></pre>
  
  <p>And my App.config for the library looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5555555555555555"&gt;
        &lt;section name="RTXEngineLib.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
    &lt;!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="RTXEngineLib.RTXEngineLib"&gt;
          &lt;endpoint address="" binding="wsHttpBinding" contract="RTXEngineLib.IRTXEngineLib"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/RTXEngineLib/RTXEngineLib/" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
    &lt;applicationSettings&gt;
      &lt;RTXEngineLib.Properties.Settings&gt;
        &lt;setting name="RTXEngineLib_externalLibrary" serializeAs="String"&gt;
          &lt;value&gt;http://externalLibrary.com/websvcs/externalLibrary.asmx&lt;/value&gt;
        &lt;/setting&gt;
      &lt;/RTXEngineLib.Properties.Settings&gt;
    &lt;/applicationSettings&gt;
  &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;&lt;/configuration&gt;
  </code></pre>
  
  <p>And then my Web.config is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.0" /&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;webHttpBinding&gt;
          &lt;binding name="Web" sendTimeout="00:03:00" maxBufferSize="131072"
            maxReceivedMessageSize="131072" /&gt;
        &lt;/webHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;services&gt;
        &lt;service behaviorConfiguration="Basic" name="RTXEngineLib.RTXEngineLib"&gt;
          &lt;endpoint address="http://devrtxengine.telemark/RTXService.svc"
            binding="webHttpBinding" bindingConfiguration="Web" name="Basic"
            contract="RTXEngineLib.IRTXEngine" listenUri="http://devrtxengine.myserver/RTXService.svc" /&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name=""&gt;
            &lt;serviceMetadata httpGetEnabled="true" /&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
          &lt;/behavior&gt;
          &lt;behavior name="Basic"&gt;
            &lt;serviceMetadata httpGetEnabled="true" /&gt;
          &lt;/behavior&gt;
          &lt;behavior name="Web"&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
              httpGetBindingConfiguration="" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="false" /&gt;
    &lt;/system.serviceModel&gt;
   &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;/system.webServer&gt;  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I attempt to run my service using <code>http://devrtxengine.myserver/RTXService.svc/GetCountryList</code> I end up with the following error:</p>
  
  <pre><code>&lt;Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"&gt;
  &lt;Code&gt;
  &lt;Value&gt;Sender&lt;/Value&gt;
  &lt;Subcode&gt;
  &lt;Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none"&gt;a:DestinationUnreachable&lt;/Value&gt;
  &lt;/Subcode&gt;
  &lt;/Code&gt;
  &lt;Reason&gt;
  &lt;Text xml:lang="en-US"&gt;
  The message with To 'http://devrtxengine.telemark/RTXService.svc/GetCountryList' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
  &lt;/Text&gt;
  &lt;/Reason&gt;
  &lt;/Fault&gt;
  </code></pre>
  
  <p>I suspect that there is some kind of mismatch between my App.config and my Web.config, but every time I try to change something in my Web.config I break my service even more than it is already broken. Does anyone with more WCF experience have any advice?</p>