I came across this error when I tried hosting a WCF endpoint from a website in IIS. This can be resolved by adding the following section in the web.config file <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix=http://www.myhost.com/ />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Why does this happen?When you host a website using a shared hosting provider, it is possible that there are multiple IIS bindings for the site. This results in multiple base addresses for each scheme which WCF doesn't support. Hence, we use the baseAddressPrefixFilters to filter out the IIS bindings and only use the relevant one for the WCF endpoint. Read more: My Tryst with Code
<baseAddressPrefixFilters>
<add prefix=http://www.myhost.com/ />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
Why does this happen?When you host a website using a shared hosting provider, it is possible that there are multiple IIS bindings for the site. This results in multiple base addresses for each scheme which WCF doesn't support. Hence, we use the baseAddressPrefixFilters to filter out the IIS bindings and only use the relevant one for the WCF endpoint. Read more: My Tryst with Code
0 comments:
Post a Comment