Last post Jul 18, 2017 02:12 AM by Edward Z
Jul 13, 2017 03:41 PM|AnkitaGoel|LINK
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://computername/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
<binding name="NewBinding0" portSharingEnabled="true">
<security mode="None" />
<service behaviorConfiguration="My" name="WCFServiceOM.Service1"> <!-- the service name must match the configuration name for the service implementation. -->
<endpoint address="" binding="basicHttpBinding" contract="WCFServiceOM.IService1"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint binding="netTcpBinding" bindingConfiguration="NewBinding0" contract="WCFServiceOM.IService1" />
<endpoint address="mexOM" binding="mexTcpBinding" contract="IMetadataExchange"/>
<add baseAddress="net.tcp://localhost:8087/Service1" />
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- 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 -->
And my client App.Config look like
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
<binding name="BasicHttpBinding_IService1" />
<security mode="None" />
contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
<endpoint address="net.tcp://computername/Service.svc" binding="netTcpBinding"
Jul 14, 2017 05:36 AM|Edward Z|LINK
Thanks for your post.
It seems you post the same issue in MSDN forum, I would suggest check my reply in below thread.
#Problems with Hosting WCF service on IIS (Using WAS) for netTCP bindings?
If you have any issue about this, please feel free to let me know.
Jul 14, 2017 06:34 PM|AnkitaGoel|LINK
Thank you so much Edward for your reply. The solution you mentioned in MSDN forum works fine. But why it doesnot work in my case.
Let me explain all the steps I did in detail.
1. Created WCF Service Library project. (because I might want to host it in some other host than IIS in future, so to keep my options open). Deleted App.config file (as for now I will not be using it)
2. Right Click on Solution -> Add -> New Website -> Selected WCF Service and created a website. Deleted IService1 and Service, as those will come from WCF library.
3. Modified Web.Config file, which is my current config file and modified Service.svc file to refer to WCF library classes. It looks like this
<%@ ServiceHost Language="C#" Debug="true" Service="WCFServiceOM.Service1" %>
4. Open IIS, added a new site and mapped it to my website location. In Advanced Settings, modified enabled protocol ->http,net.tcp and Binding -> http:*:85:,net.tcp:808:*,net.msmq:localhost,msmq.formatname:localhost,net.pipe:*
Browsing Service.svc from IIS. It opens webpage saying you created service.
5. Copying the URL from webpage and adding it as a service reference in a console app. It adds a service reference , generates proxy code and modify App.config file (automatically by VS).
6. Use the following code in Console app.
Service1Client om = new Service1Client("NetTcpBinding_IService1");
string om1 = om.GetData(5);
Console.WriteLine("Result " + om1);
7. On line 2, it gives this error.
An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll
Additional information: There was no endpoint listening at net.tcp://Computername/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action.
For Http binding it works fine.
8. If I change binding in client's App.Config for netTCP from address="net.tcp://computername/Service.svc" to address="net.tcp://computername:8087/Service.svc" (I mentioned 8087 in web.config path - <add baseAddress="net.tcp://localhost:8087/Service1"
If I do that, error changes from the above one to
Additional information: Could not connect to net.tcp://computername:8087/Service.svc. The connection attempt lasted for a time span of 00:00:04.0054055. TCP error code 10061: No connection could be made because the target machine actively refused
Jul 17, 2017 06:46 AM|Edward Z|LINK
Since my solution works, and I think it is not convenience to follow the same issue with the same reply.
Would you mind marking my solution as answer to close this thread, and for any further discussion about your steps did not work, we could focus on the thread in MSDN forum.
Jul 17, 2017 02:47 PM|AnkitaGoel|LINK
I marked your reply as answer.
Could you please help me figuring out why my set up is not working though. Thanks so much.
Jul 18, 2017 02:12 AM|Edward Z|LINK
I have followed the below thread, could you check below thread, and share us more information?