打开nettcpbinding WCF服务时无效的opertion异常 [英] Invalid opertion exception when I open a nettcpbinding WCF service
问题描述
大家早上好,
我正在开发一个托管WCF服务的Windows应用程序。
我正在使用NetTcpBinding,当我尝试打开一个连接时,会抛出一条带有此消息的InvalidOpenException:
ContractDescption'IHyperisCommonService'不包含任何操作;合同必须至少包含一项操作。
但在我的情况下,我的界面如下所示:
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:
[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:
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();
有人有线索吗?
感谢您的帮助。
我的尝试:
我已经在同一台机器上使用此WCF服务与之前的应用程序。
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.
推荐答案
我用Google搜索了您的错误消息并找到了这个
WCF错误:ContractDescription'......'没有操作;合同必须至少有一项操作。 [ ^ ]
请在询问谷歌搜索任何错误信息之前进行基础研究。
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.
这篇关于打开nettcpbinding WCF服务时无效的opertion异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!