Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 服务没有应用程序(非基础结构)终结点_Wcf_Windows Hosting - Fatal编程技术网

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

Wcf 服务没有应用程序(非基础结构)终结点,wcf,windows-hosting,Wcf,Windows Hosting,我知道还有其他同名问题。我尝试了他们的解决方案,但毫无结果 在向installutil注册服务后,我在尝试启动服务(Windows托管)时收到此消息 我没有使用WCF的经验,请耐心等待 我的服务应用程序由两个项目组成:Externals,其中我有我的服务接口、客户端接口、数据契约和app.config,以及包含服务实现的内部(它是主机,实际实现是在另一个文件中完成的,该文件不是从我的服务接口继承的,我不确定这是否是一个好的做法)。 我的app.config: <?xml version="

我知道还有其他同名问题。我尝试了他们的解决方案,但毫无结果

在向
installutil
注册服务后,我在尝试启动服务(Windows托管)时收到此消息
我没有使用WCF的经验,请耐心等待

我的服务应用程序由两个项目组成:Externals,其中我有我的服务接口、客户端接口、数据契约和app.config,以及包含服务实现的内部(它是主机,实际实现是在另一个文件中完成的,该文件不是从我的服务接口继承的,我不确定这是否是一个好的做法)。
我的app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="Internals.ExecutionService" behaviorConfiguration="Default">
        <endpoint name="TCPEndpoint" 
                  address="net.tcp://localhost:8080/ExecutionService" 
                  binding ="netTcpBinding" 
                  contract="Externals.IExecutionService"/>
        <endpoint address="mex" 
                  binding="mexTcpBinding" 
                  contract="IMetadataExhange"/>
        <host>
          <baseAddresses>
            <add baseAddress="netTcp://localhost:8080/ExecutionService"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
以及接口的空实现

完全错误:

Service cannot be started. System.InvalidOperationException: Service 'Internals.ExecutionService' 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.
   at System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreApplicationEndpoints(ServiceDescription description)
   at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
   at System.ServiceModel.ServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnBeginOpen()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()
   at Internals.ExecutionService.OnStart(String[] args) in C:\Users...

取自事件查看器。

您的app.config应该是内部的,而不是外部的。将其重命名为Internals.exe.config(或您的“Internals”exe命名的任何名称),并将其与服务exe放在同一目录中。

您的app.config应该是内部的,而不是外部的。将其重命名为Internals.exe.config(或您的任何名称)“内部构件”exe已命名)并将其与您的服务exe放在同一目录中。

我认为您正在混合Windows服务和WCF服务的实现。这是两个独立的实体,请尝试将它们分为两个类,每个类对应一个。Windows服务不应实现该契约。并且不要忘了复制实际的WCF app.config serviceModel se进入winservice app.config的操作winservice app.config是什么?上面发布了哪个项目的app.config?它是内部的吗?另外,您有用绝对地址指定的基址。我建议只使用一个。app.config在外部项目中。您所说的“只使用一个”是什么意思?(让我提醒您,我以前从未使用过
WCF
)我认为您正在混合Windows服务和WCF服务的实现。这是两个独立的实体,请尝试将它们分成两个类,每个类对应一个问题。Windows服务不应实现该契约。并且不要忘记将实际的WCF app.config serviceModel节复制到winservice app.configwhat’s winservice app.conf中ig?上面发布的是哪个项目的app.config?它是内部的吗?另外,你有用绝对地址指定的基址。我建议只使用一个app.config。app.config在外部项目中。你说“只使用一个”是什么意思?(让我提醒你,我以前没有使用过
WCF
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)]
    public partial class ExecutionService : ServiceBase, IExecutionService
    {
        ServiceHost myHost;
        private IClientCallback callbackChannel;

        public ExecutionService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            myHost = new ServiceHost(typeof(ExecutionService));
            myHost.Open();
        }
}
Service cannot be started. System.InvalidOperationException: Service 'Internals.ExecutionService' 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.
   at System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreApplicationEndpoints(ServiceDescription description)
   at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
   at System.ServiceModel.ServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnBeginOpen()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()
   at Internals.ExecutionService.OnStart(String[] args) in C:\Users...