IIS WCF Config: service only uses default behavior -


i learning wcf deployment in iis , have found strange. service uses default behavior regardless of how set behaviorconfiguration attribute of element in web.config.

so here's relevant piece of web.config:

<system.servicemodel> <services>   <service name="tableimport" behaviorconfiguration="myservicetypebehaviors">     <endpoint address="" binding="wshttpbinding" />   </service> </services>  <behaviors>   <servicebehaviors>     <behavior>       <servicemetadata httpgetenabled="false" />     </behavior>     <behavior name="myservicetypebehaviors" >       <servicemetadata httpgetenabled="true" policyversion="policy15" />     </behavior>   </servicebehaviors> </behaviors> </system.servicemodel> 

as can see default servicemetadata element has httpgetenabled="false" whereas myservicetypebehaviors servicemetadata element has httpgetenabled="true". can see service's behaviorconfiguration attribute set "myservicetypebehaviors".

the result should service publishes metadata through browser , through visual studio "add service reference" feature same result: no metadata.

on other hand if enable metadata in default behavior , disable in "myservicetypebehaviors" , continue have service use myservicetypebehaviors metadata both through browser , through vs.

to me, these tests indicate service uses default behavior regardless of how set config file... @ same time can change default behavior through web.config web.config in fact able affect how service works. ideas?

you don't specify contract in endpoint, without contract endpoint notgoing know service it's using.

if you're using .net 4.0 or later (and based on issues described sounds are), you're connecting default endpoint based on address of service. default endpoint provided framework.

as such, use default service behavior. matches problem description:

 -  when default behavior's httpgetenabled set false, no metadata. -  when default behavior's httpgetenabled set true, metadata. 

the easiest solution in situation add contract endpoint trying define:

<endpoint address="" binding="wshttpbinding" contract="fullyqualified.icontractname" /> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -