WCF BUG has zero application (non-infrastructure) endpoints.

本文详细介绍了在部署WCF服务时遇到的配置问题,即配置文件中的配置节点与IIS中的协议不一致导致的服务启动失败。通过对比配置节点与IIS配置,发现缺少了必要的协议配置。解决方案是在配置节点中添加缺失的协议配置项,从而成功激活并运行服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Server Error in '/***.Location.**Services' Application.

Service 'Service' 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.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Service 'Sensitech.Location.AppServices.LocationManagerAppService' 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.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Service '**.**.**.***ManagerAppService' 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.]
   System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreApplicationEndpoints(ServiceDescription description) +356
   System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +120
   System.ServiceModel.ServiceHostBase.InitializeRuntime() +93
   System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +48
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +307
   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +130
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +738

[ServiceActivationException: The service '/**.**.**/**AppService.svc' cannot be activated due to an exception during compilation.  The exception message is: Service 'Se**n***s*ite**ch.L**oc**a*ti*n*.AppSe***rvices.Loca**tion**Ma**nage*rAppSer*vice' 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..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +604403
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +238
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0



有时候部署WCF会遇到这个问题。原因是配置文件中的配置节点binding和IIS中的协议不符合。比较一下配置节点就可以明白。


先看配置节点:

<endpoint address="net.tcp://localhost/Sensitech.Alarm.AppServices/AlarmManagerAppService.svc"
    binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IAlarmManagerAppService"
    contract="Sensitech.Alarm.Contracts.IAlarmManagerAppService" name="NetTcpBinding_IAlarmManagerAppService">
    <identity>
      <userPrincipalName value="localhost" />
    </identity>
  </endpoint>

在检查IIS的配置: 看到behavior 缺少了net.tcp配置。加上之后就好了




将缺少的协议加上



在次调用。就可以了




另外:如果缺少了http,会报这个503的错误



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值