Tuesday 3 July 2012

Splitting out WCF Configuration

In order to make our site's configuration a little easier to maintain, I was looking for an elegant way to split out WCF configuration from our site's Web.config. It turns out this is very simple. Even though Visual Studio complains, the following works perfectly:

Web.Config
1
2
3
4
5
6
<system.serviceModel>
    <!--The editor complains about this, but it works at runtime-->
    <behaviors configSource=".\Config\system.servicemodel.behaviors.config"></behaviors>
    <bindings configSource=".\Config\system.servicemodel.bindings.config"></bindings>
    <client configSource=".\Config\system.servicemodel.client.config"></client>
</system.serviceModel>
As described by the following stackoverflow post shows exactly how. Just copy each of the sections <behaviors>, <bindings>, <client> into it's own file

No comments:

Post a Comment