服务''没有应用程序(非基础结构)端点

era*_*zap 14 wcf

我一直得到一个无法解释的例外

 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.
Run Code Online (Sandbox Code Playgroud)

我遇到过解决这个问题的其他帖子,但似乎没有人有一个确切的答案,而且他们的解决方案没有为我工作.

服务没有应用程序(非基础结构)端点

这里的任何方式都是我的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>
Run Code Online (Sandbox Code Playgroud)

我的合同:

[ServiceContract(Namespace="Some.Test")]
public interface IEmployeeManagerService
{
    [OperationContract]
    string Test();    
}
Run Code Online (Sandbox Code Playgroud)

我的服务:

public class EmployeeManagerService : IEmployeeManagerService
{
    public string Test()
    {
        return "test";
    }
}
Run Code Online (Sandbox Code Playgroud)

在相关帖子中,人们建议给Contract一个名称空间,并在app.config中将其用作服务选项卡中名称的前缀.

还有一个建议暴露mex终点...我真的不知道这是怎么做的,但我做了任何方式.

为什么会发生这种情况的任何想法?以及如何真正解决这个问题?

Phi*_*son 11

从你自己的评论:

将服务的name属性设置为与包含命名空间的实现完全相同的名称

<service name="EmployeeManagerImplementation.EmployeeManagerService">