【发布时间】:2012-04-06 13:00:41
【问题描述】:
我不断收到无法解释的异常
Service 'EmployeeManagerImplementation.EmployeeManagerService' has zero application (non-infrastructure)
endpoints. This might be because no configuration file was found for your application,
or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
我遇到了其他解决了这个问题的帖子,但似乎没有人有一个精确的 答案,他们的解决方案都不适合我。
Service has zero application (non-infrastructure) endpoints
这里是我的 app.config 的任何方式
<system.serviceModel>
<services>
<service name="Some.Test.EmployeeManagerService">
<endpoint address="net.tcp://localhost:8080/Service" binding="netTcpBinding"
bindingConfiguration="" contract="Contracts.IEmployeeManagerService" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
我的合同:
[ServiceContract(Namespace="Some.Test")]
public interface IEmployeeManagerService
{
[OperationContract]
string Test();
}
我的服务:
public class EmployeeManagerService : IEmployeeManagerService
{
public string Test()
{
return "test";
}
}
在相关帖子中,人们建议给合同一个命名空间,并将其用作我的 app.config 中服务选项卡中名称的前缀。
还有一个建议是公开 mex 端点... 我真的不明白这与它有什么关系,但我以任何方式做到了。
所以对为什么会发生这种情况有任何想法吗? 以及如何真正解决这个问题?
【问题讨论】:
-
o'k 事实证明,需要为服务的 name 属性提供与实现相同的名称,包括命名空间
感谢@Johann Blais @987654322 @ -
您应该将此添加为答案并接受它。
-
我放了一个对我有帮助的答案的链接......同样好:)
标签: wcf