WCF分布式开发常见错误解决(6)Service 'WcfServiceApp.WCFService' has zero application
来源:互联网 发布:java注解类 编辑:程序博客网 时间:2024/06/13 21:54
Posted on 2009-03-29 17:57 Frank Xu Lei 阅读(416) 评论(0) 编辑 收藏 网摘 所属分类: WCF分布式开发常见错误
调试WCF服务应用程序的时候,会出现如下错误:
“/”应用程序中的服务器错误。
Service 'WcfServiceApp.WCFService' 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.
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.InvalidOperationException: Service 'WcfServiceApp.WCFService' 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.
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
此错误由于没有服务终结点所致。
解决办法1:在配置文件添加代码,配置服务节点:
<endpoint address="" binding="wsHttpBinding" contract="WcfServiceApp.IWCFService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
解决办法2:编程方式添加服务节点
using (ServiceHost host = new ServiceHost(typeof(WCFService.WCFService)))
{
Uri tcpAddress = new Uri("net.tcp://localhost:8001/WCFService");
host.AddServiceEndpoint(typeof(WCFService.IWCFService), new NetTcpBinding() , tcpAddress);
if (host.State !=CommunicationState.Opening)
host.Open();
//显示运行状态
Console.WriteLine("Host is runing! and state is {0}",host.State);
//等待输入即停止服务
Console.Read();
}
{
Uri tcpAddress = new Uri("net.tcp://localhost:8001/WCFService");
host.AddServiceEndpoint(typeof(WCFService.IWCFService), new NetTcpBinding() , tcpAddress);
if (host.State !=CommunicationState.Opening)
host.Open();
//显示运行状态
Console.WriteLine("Host is runing! and state is {0}",host.State);
//等待输入即停止服务
Console.Read();
}
【老徐的博客】
【作者】:Frank Xu Lei
【地址】:http://www.cnblogs.com/frank_xl/archive/2009/03/29/1424507.html
- WCF分布式开发常见错误解决(6)Service 'WcfServiceApp.WCFService' has zero application
- WCF分布式开发常见错误(16):The Transaction has aborted,事务已经被中断
- WCF分布式开发常见错误(15):Communication with the underlying transaction manager has failed.
- WCF分布式开发常见错误(26):Authentication failed because the remote party has closed the transport stream.
- WCF分布式开发常见错误(27):Secure channel cannot be opened because security negotiation with the remote endpoint has failed
- WCF BUG has zero application (non-infrastructure) endpoints.
- WCF分布式开发常见错误(20):TimeoutException was unhandled
- WCF分布式开发常见错误(17):无法启动MSMQ服务
- WCF分布式开发常见错误解决(9):无终结点监听,There was no endpoint listening at
- WCF分布式开发常见错误解决(7):System.InvalidOperationException,Cannot have two operations in the same contract
- WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错
- WCF分布式开发常见错误解决(12):The server was unable to process the request,服务无法处理请求
- WCF分布式开发常见错误(3):客户端调用服务出错:You have tried to create a channel to a service that does not support .Net Framing
- acpi package has zero elements错误的解决
- WCF 找不到类型 WcfService
- WCF分布式开发常见错误(21):unable to open its IChannelListener.分发器未能打开侦听器
- WCF分布式开发常见错误(18):Binding validation failed 绑定协议验证失败
- WCF分布式开发常见错误(14):无效的操作异常,At least one operation on the ...
- WCF分布式开发步步为赢(6):WCF服务契约继承与分解设计
- WCF分布式开发步步为赢(5)服务契约与操作重载
- WCF分布式开发常见错误解决(7):System.InvalidOperationException,Cannot have two operations in the same contract
- WCF分布式开发步步为赢(4):WCF服务可靠性传输配置与编程开发
- WCF分布式开发步步为赢(3)WCF服务元数据交换、配置及编程开发
- WCF分布式开发常见错误解决(6)Service 'WcfServiceApp.WCFService' has zero application
- WCF分布式开发步步为赢(2)自定义托管宿主WCF解决方案开发配置过程详解
- Ubuntu常用命令列表
- WCF分布式开发常见错误(5)Could not find a base address that matches scheme
- WCF分布式开发常见错误(4):The type or namespace name 'DataContract' could not be found DataContract找不到
- c3p0与dbcp 数据源配置方式
- WCF分布式开发步步为赢(1):WCF分布式框架基础概念
- WCF分布式开发常见错误(3):客户端调用服务出错:You have tried to create a channel to a service that does not support .Net Framing
- WCF分布式开发常见错误(2)无法从传输连接中读取数据: 远程主机强迫关闭了一个现有的连接。。