前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >解决 wcf HTTP 无法注册 另一应用程序正在使用 TCP 端口 80

解决 wcf HTTP 无法注册 另一应用程序正在使用 TCP 端口 80

作者头像
lpxxn
发布2018-01-31 10:27:23
8910
发布2018-01-31 10:27:23
举报
文章被收录于专栏:技术之路技术之路

在看wcf广播事件的程序时候,运行到

代码语言:javascript
复制
ILogService service = DuplexChannelFactory<ILogService>.CreateChannel(client,
                new WSDualHttpBinding(), new EndpointAddress("http://localhost:8567/server"));

报出个异常 

HTTP 无法注册 URL http://+/Temporary_Listen_Addresses/144ff7cb-10a4-4836-b76a-1a516da4ebda/,因为另一应用程序正在使用 TCP 端口 80。

当我们用WSDualHttpBinding进行双工通信时

在默认情况下,回调接口会使用80端口,clientBaseAddress为http://localhost:80  而80端口已经被IE浏览器占用,

如果我们不在客户端的代理端做任何事情的话,很可能出这个错误

解决方法:

1修改代码

代码语言:javascript
复制
DuplexChannelFactory<ILogService> channelFactory = new DuplexChannelFactory<ILogService>(instanceContext);

WSDualHttpBinding ws = new WSDualHttpBinding();
ws.ClientBaseAddress = new Uri("http://localhost:8566");
channelFactory.Endpoint.Binding = ws;

channelFactory.Endpoint.Address = new EndpointAddress("http://localhost:8567/server");
ILogService service = channelFactory.CreateChannel();

2修改配置文件

代码语言:javascript
复制
<wsDualHttpBinding clientBaseAddress="http://localhost:8566/server"/>
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2012-11-16 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档