WCF 零个应用程序(非基础结构)终结点。请教。

liuxiuming 2010-11-29 07:00:43
WCF寄宿在一个Console程序里。配置文件如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<netMsmqBinding>
<binding name="Services.EmailService.Service.MsmgBinding" exactlyOnce="false">
<security mode="None">
</security>
</binding>
</netMsmqBinding>
</bindings>
<services>
<service name="WcfMsmqTest.ResponseService">
<endpoint address="net.msmq://192.168.1.88/private/KeedeEmailService"
binding="netMsmqBinding" bindingConfiguration="Keede.Services.EmailService.Service.MsmgBinding"
contract="Services.EmailService.Contract.IMailService" />
<host>
<baseAddresses>
<add baseAddress="http://192.168.1.88:4321/service" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
-------------
服务代码
ServiceHost _serviceHost = new ServiceHost(typeof(Keede.Services.EmailService.Service.MailService));
_serviceHost.Open();
-------------
运行时候会报错如下
零个应用程序(非基础结构)终结点。这可能是因为未找到应用程序的配置文件,或者在配置文件中未找到与服务名称匹配的服务元素,或者服务元素中未定义终结点。
-------------
查了 基本是webconfig问题,不过跟我以前的没撒区别,知道的赐教。
...全文
176 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuxiuming 2010-12-01
  • 打赏
  • 举报
回复
是服务名写错了。。不能乱起的
mooniscrazy 2010-11-29
  • 打赏
  • 举报
回复
用一个控制台程序做客户端,再用相同的配置代码试试。这样比较容易查出错误。
mooniscrazy 2010-11-29
  • 打赏
  • 举报
回复
原因:此端口已经被使用,即已经有程序在使用一个相同的端口所致。必须我们配置两个服务终结点使用一个终结点端口

(1)检查机器的端口,确保此端口不是系统服务端口,或者没被其他程序使用。

(2)检查服务终结点配置信息,确保两个不同的服务使用不同的终结点端口

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧