Reputation: 740
I am trying to create a WCF service that requires session support so I added a section in my web.config to enable wsHttpBinding. But when I test the service in the WCF Test Client and check the config it seems to have taken the default auto generated config instead of my own.
See my config :
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="UserService">
<endpoint address="" binding="wsHttpBinding" contract="ICenterPlaceUserService" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
And the result :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICenterPlaceUserService" sendTimeout="00:05:00" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:57418/L1.WCF/CenterPlaceUserService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICenterPlaceUserService"
contract="ICenterPlaceUserService" name="BasicHttpBinding_ICenterPlaceUserService" />
</client>
</system.serviceModel>
What am I missing ?
Upvotes: 2
Views: 5516
Reputation: 87228
The name
attribute of the <service>
attribute must have the fully-qualified name of the service class. Otherwise it will be ignored, and you'll see the behavior you're seeing: the default binding is used for the service (basicHttpBinding).
<services>
<service name="TheNamespaceOfYourClass.UserService">
<endpoint address=""
binding="wsHttpBinding"
contract="TheNamespaceOfYourContract.ICenterPlaceUserService" />
</service>
</services>
Upvotes: 12