(Windows防火墙或第三方) 不阻止端口8526 的(端口号这是用来EM中的例子)。 。指定一个例外,允许该端口的传入和传出的流量4th option: If you run the service on a remote computer, you need to specify the proper host name or IP address of the host instead of localhost, and you need to ensure that the personal firewall (windows firewall or 3rd party) doesn't block the port 8526 (the port number which was used in the example). Specify an exception to allow this port for incoming and outgoing traffic. 5次和最后一个选项(更新): 命名冲突 - 服务1是服务,而且在WCF库中的类名。要么完全限定你从 WCF库在服务上,即 WcfServiceLibrary1.Service1 使用类名或重命名的类。 Whytheq发现它自己与同事和贴吧的这里5th and final option (UPDATE): Naming conflict - Service1 is the service but also the class name in the Wcf library. Either fully qualify the class name you're using from the WCF library in the service, i.e. WcfServiceLibrary1.Service1 or rename the class. Whytheq has found it himself with a colleague and as posted it here. 更多阅读: 看看这篇文章,我最近发现: WCF:几个小技巧。它解释了很好的故障排除WCF。我想唯一的变化在控制台取得托管的例子是为替换在使用语句按More reading: Check out this article, which I've found recently: "WCF: a few tips". It explains very well troubleshooting WCF. The only change I would made to the console hosting example is to replace the using statement by aServiceHost host = new ServiceHost(typeof(Service));try{ host.Open(); Console.WriteLine("WCF Service is ready for requests." + "Press any key to close the service."); Console.WriteLine(); Console.Read(); Console.WriteLine("Closing service...");}finally{ if (host!=null) { host.Close(); host=null; }}如果您想了解更多关于原因,看看这篇文章:代理启闭If you want to know more about the reason why, check out this article: "Proxy open and close". 这篇关于消费是在Windows服务从外部解决方案托管WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-02 11:07