Click here to Skip to main content
15,885,782 members
Articles / Programming Languages / XML

WCF - Could Not Find A Base Address that Matches Scheme

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 Jul 2011CPOL 15.1K   2  
This error indicates that there is no base address handling the request on that particular scheme (HTTP/HTTPs) and base address (URL).

This error indicates that there is no base address handling the request on that particular scheme (HTTP/HTTPS) and base address (URL). For example, your WCF Web based address in web.config may be this:

  • http://mysite.com/myservice.svc (WCF allows a single based address per scheme HTTP/HTTPS)

IIS may be configured to support multiple base addresses like these:

  • http://mysite.com
  • http://www.mysite.com

If you try to load the URL http://www.mysite.com/myservice.svc, IIS resolves the address, but the WCF setting is in conflict, and an error is shown. Using the web.config, we can add a setting to filter the IIS base address that is not mapped to the WCF based address (add the setting in the system.serviceModel node).

XML
<serviceHostingEnvironment> 
      <baseAddressPrefixFilters> 
       <add prefix="http://www.mysite.com" /> 
      </baseAddressPrefixFilters> 
</serviceHostingEnvironment>

This should eliminate the conflict, and the request should go to the base address defined by web.config. In addition, a common mistake is that baseAddressPrefixFilters may be set to the same base address of the WCF service. This filters out the base address and causes a “Could not find base address error”. Following our previous scenario, if you add the setting below, the error will be recreated.

XML
<serviceHostingEnvironment> 
 <baseAddressPrefixFilters> 
   <add prefix="http://mysite.com" /> (filters The wcf base address – error is shown) 
   <add prefix="http://www.mysite.com"/> 
</baseAddressPrefixFilters> 
</serviceHostingEnvironment>

I hope this helps!

This article was originally posted at http://ozkary.blogspot.com/feeds/posts/default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect OG-BITechnologies
United States United States
Software engineer, author & speaker who enjoys mentoring, learning, speaking and sharing with others about software development technologies. Microsoft MVP.

My Blog

Comments and Discussions

 
-- There are no messages in this forum --