建立了一个ConsoleApplication1控制台程序,引用了WcfServiceLibrary1。
控制台程序放在远程电脑上运行。
然后在本地建立了一个工程,想引用远程的服务,为什么找不到???
是URL写的不对吗?
就是把控制台上的 宿主基地址的 LocalHost,改成该电脑的ip了。
请问问题出在哪里???
------解决方案--------------------
有很多可能性,比如你是否使用了正确的绑定(http),是否正确部署,防火墙,等等。
------解决方案--------------------
用控制台作为wcf的宿主的话
引用地址不是用http开头的
还有宿主的配置文件中也要添加貌似mexchange的一个节点
所以问题多多~
------解决方案--------------------
楼上说的都有道理。
我学习WCF时也出现过引用不上的问题,当时是因为没有开启serviceMetadata 。
即你在配置文件中添加节点
<behaviors>
<serviceBehaviors>
<behavior name="WcfServiceApp.WCFServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true.Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
然后再你的service节点使用声明的behavior
<service name="WcfServiceApp.WCFService" behaviorConfiguration="WcfServiceApp.WCFServiceBehavior">
------解决方案--------------------
贴出你ip以及创建web service服务器的那几行代码。
比如说我的笔记本现在的ip是192.168.42.1,你怎么找它?
当服务器运行时,先可以从浏览器上去访问,它会自己现实wsdl之类的页面。如果根本连不上,那么就不要再去用什么“本地工程去找”它了。
------解决方案--------------------