WCF中的由于目标计算机积极拒绝,无法连接
1.第一种情况
百度上找到了这篇文章 http://blog.sina.com.cn/s/blog_6b44b2ba01016j0z.html
讲的是使用了using用完之后就释放了,得到启发,仔细检查了Host的代码
对比了Learning WCF第一章中的示例代码,发现用try finally来执行的
在finally中将服务关闭了
try { //打开服务的代码 //有2个Service打开 } finally { CloseHost(hostA); CloseHost(hostB); }
2.第二种情况
因为之前电脑崩溃过一次,导致本机的net.tcp服务没有激活
http://stackoverflow.com/questions/22562596/unable-to-access-wcf-service-using-net-tcp-binding
Finally with the help of this link: http://rohitguptablog.wordpress.com/2011/06/16/configuring-wcf-service-with-nettcpbinding/, I figured out what was going wrong. Actually I missed the third step in above link. The Net.Tcp services were not running.
====2015年09月14日更新====
发现这个问题有又出现了,本来设置的是自动启动Net.Tcp Listener Adapter
电脑重新开机后,这个服务没有自动启动
查看这个服务的属性-->依存关系
发现Net.Tcp Port Sharing Service没有自动启动
解决方法:
将Net.Tcp Port Sharing Service这个服务改为自动启动。
4.新建了website以及application。
website添加了net.tcp的binding之后
需要记得给application添加net.tcp的protocol
5.有可能没有安装wcf服务
https://help.genesys.com/cic/mergedProjects/wh_tr/mergedProjects/wh_tr_web_portal_marquee/desktop/activate_windows_communication_foundation_wcf.htm
Activate WCF for Windows Server 2016
-
From the Start menu, select Administrative Tools > Server Manager.
-
Select Add roles and features from the Dashboard.
-
Select Next twice.
-
Select Features.
-
In the Features area, expand the:
- .NET Framework 3.5 Features and select HTTP Activation and Non-HTTP Activation.
- .NET Framework 4.6 Features and select WCF Services. -
Under WCF Services select:
- HTTP Activation
- Messsage Queuing (MSMQ) Activation
- Named Pipe Activation
- TCP Activation
- TCP Port Sharing
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了