发布于 1年前

WCF Service访问报错:The message could not be dispatched because the service at the endpoint address "net.tcp://xxx" is unavailable for the protocol of the address

使用.NET4搭建的WCF服务,访问WCF服务时报错:

The message could not be dispatched because the service at the endpoint address ‘net.tcp://localhost:1002/MyService.svc’ is unavailable for the protocol of the address.

每次重启机器是可以解决问题,但这样做显然不是一个好的解决方案,重启费时又繁琐,且影响服务的使用。

在网上找到了一个方案,使用ServiceModelReg.exe注册,步骤:

  1. 打开命令行工具
  2. 进入C:\windows\microsoft.net\framework64\v4.0.30319
  3. 用下面的命令注册服务模型:ServiceModelReg.exe -r
©2020 edoou.com   京ICP备16001874号-3