Ankita Goel

Ankita Goel

  • NA
  • 19
  • 6.8k

Problems with Hosting WCF service on IIS (Using WAS) for net

Jul 13 2017 11:34 AM

I created a simple WCF service and hosted it in IIS by creating a new website. In Web.config file,I am providing bindings for http and net tcp. I created a console client and adding service reference. It generates two binding in client config - for http and for tcp. When I try to invoke the service using tcp, I get this error -

An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll Additional information: There was no endpoint listening at net.tcp://agoel.extron.com/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action.

when I run using Http endpoint , it works fine. Note - I am using Windows 10 OS, IIS 10.0 and WPAS\WAS (Windows Process Activation Service) are installed. I already enabled\checked HTTP Activation, TCP Activation in .Net framework in Windows features. And modified IIS server settings to include net tcp.
  My website Web.config file looks like
  1.  <system.serviceModel>  
  2. <bindings>  
  3.   <netTcpBinding>  
  4.     <binding name="NewBinding0" portSharingEnabled="true">  
  5.       <security mode="None"  />  
  6.     binding>  
  7.   netTcpBinding>  
  8. bindings>  
  9. <services>  
  10.   <service behaviorConfiguration="My" name="WCFServiceOM.Service1">   
  11.     <endpoint address="" binding="basicHttpBinding" contract="WCFServiceOM.IService1"/>  
  12.     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>  
  13.     <endpoint  binding="netTcpBinding" bindingConfiguration="NewBinding0" contract="WCFServiceOM.IService1" />  
  14.     <endpoint address="mexOM" binding="mexTcpBinding" contract="IMetadataExchange"/>  
  15.     <host>  
  16.       <baseAddresses>  
  17.         <add baseAddress="net.tcp://localhost:8087/Service1" />  
  18.         <add baseAddress="http://localhost:7777/Service1"/>  
  19.       baseAddresses>  
  20.     host>  
  21.   service>  
  22. services>  
  23. <behaviors>  
  24.   <endpointBehaviors>  
  25.     <behavior name="webBehanior">  
  26.       <webHttp/>  
  27.     behavior>  
  28.   endpointBehaviors>  
  29.   <serviceBehaviors>  
  30.     <behavior name="My">  
  31.         
  32.       <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>  
  33.         
  34.       <serviceDebug includeExceptionDetailInFaults="true"/>  
  35.     behavior>  
  36.   serviceBehaviors>  
  37. behaviors>  
And my client App.Config look like
 
  1. <configuration>  
  2. <startup>   
  3.     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />  
  4. startup>  
  5. <system.serviceModel>  
  6.     

Answers (1)