Thursday, January 26, 2012

WCF hosting in WAS

Step 1: Add a service library and a service host.
Step 2: Add tcpBinding and mexTcpBinding.
Step 3: Enable net.tcp protocol for the deployed service in Advanced Settings
section.
Step 4: Browse the svc and test the address for tcpBinding using WCFTestClient
(getting error with WcfStorm for tcp)

Step 2:

Code Snippet
  1. <?xml version="1.0"?>
  2. <configuration>
  3.  
  4.   <system.web>
  5.     <compilation debug="true" targetFramework="4.0" />
  6.   </system.web>
  7.   <system.serviceModel>
  8.     <services>
  9.       <service name="ConfirmWCFTCP.Service1" behaviorConfiguration="MyServicebehavior">
  10.         <endpoint address="" binding="netTcpBinding" contract="ConfirmWCFTCP.IService1"/>
  11.         <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
  12.       </service>
  13.     </services>
  14.     
  15.     <behaviors>
  16.       <serviceBehaviors>
  17.         <behavior name="MyServicebehavior">
  18.           <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
  19.           <serviceMetadata httpGetEnabled="true"/>
  20.           <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
  21.           <serviceDebug includeExceptionDetailInFaults="false"/>
  22.         </behavior>
  23.       </serviceBehaviors>
  24.     </behaviors>
  25.     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  26.   </system.serviceModel>
  27.   <system.webServer>
  28.     <modules runAllManagedModulesForAllRequests="true"/>
  29.   </system.webServer>
  30.  
  31. </configuration>

Step 3: