解决 wcf HTTP 无法注册 另一应用程序正在使用 TCP 端口 80
生活随笔
收集整理的這篇文章主要介紹了
解决 wcf HTTP 无法注册 另一应用程序正在使用 TCP 端口 80
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在看wcf廣播事件的程序時候,運行到
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修改代碼
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修改配置文件
<wsDualHttpBinding clientBaseAddress="http://localhost:8566/server"/>
?
轉載于:https://www.cnblogs.com/li-peng/archive/2012/11/16/wcferror.html
總結
以上是生活随笔為你收集整理的解决 wcf HTTP 无法注册 另一应用程序正在使用 TCP 端口 80的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 广州发展是国有独资企业吗
- 下一篇: apache 目录访问加密 简单