Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good morning everyone,

I’m working on a windows application that is hosting a WCF service.
I’m using NetTcpBinding and when I try to open a connection an InvalidOpenException is thrown with this message:
ContractDescption 'IHyperisCommonService' contains no operation; a contract must contain at least an operation.
But in my case my interface looks like this:

C#
[ServiceContract]
public interface IHyperisCommonService
{
   Guid IsOnLine(Guid message);
}

The worst thing is I already use this interface with another application and I don’t get the problem.

Here the code I use:
C#
ServiceHost serviceHostStatus = new ServiceHost(typeof(Hyperis.Common.HyperisCommonService));
NetTcpBinding serviceHostBinding = new NetTcpBinding();
serviceHostStatus.AddServiceEndpoint(typeof(Hyperis.Common.IHyperisCommonService), serviceHostBinding, new Uri("net.tcp://localhost:5000/HyperisCommonService"));
serviceHostStatus.Open();


Anybody have a clue ?

Thanks for helping.


What I have tried:

I already use this WCF service with a previous application on the same machine.
Posted
Updated 19-Jun-18 23:51pm

1 solution

I googled your error message and found this

WCF error : ContractDescription '...' has zero operations; a contract must have at least one operation.[^]

Please do basic research before asking a question such as googling any error messages you get.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900