[英]Accesing wcf service hosted in iis works in localhost but not if accessed by ip:port/service.svc
Web.config
<behavior name="JobsServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
<serviceMetadata httpGetEnabled = "true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<service behaviorConfiguration="JobsServiceBehavior"
name="XDE.WebServices.Implementation.JobManagerService">
<endpoint binding="wsDualHttpBinding"
name="WSDualHttpBinding_IJobManagerService"
bindingConfiguration="wsDualHttpBinding"
contract="XDE.CommonInterfaces.Jobs.IJobManagerService" />
</service>
app.config
<client>
<endpoint address="http://192.192.192.1/Services/JobService.svc"
binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IJobManagerService"
contract="XDE.CommonInterfaces.Jobs.IJobManagerService"
name="WSDualHttpBinding_IJobManagerService" />
</client>
您好,我对wcf服务有疑问。 我在服务器计算机上的iis上的mvc应用程序中托管了一项服务,当我尝试访问它时,没有任何反应,并且得到了空值。 我正在使用DuplexChannelFactory,当我调用open()方法时,一会儿什么都没有发生,然后应用关闭。 如果我将Mvc应用程序与使用服务的应用程序托管在同一台计算机上,则不会发生这种情况。
首先,我必须劝阻您不要使用wsDualHttpBinding。 通过Internet和代理/防火墙使用它时,我遇到了问题。 我同意Juval Lowy在他的书《 Programming WCF Services》(编程WCF服务)中的话:“ WSDualHttpBinding几乎是不可用的,因为实际上不可能穿越各种将服务与客户端分开的通信障碍,以及寻找特定Web服务器的需要。这不切实际”。 另请参见wsDualHttpBinding ClientBaseAddress和防火墙我强烈建议您使用NetTcpBinging / NetTcpRelayBinding(IIS / WAS托管)。
但是您可以尝试wsDualHttpBinding。 我记得我的问题出在ClientBaseAddress中 。 AFAIK- 您需要在客户端配置中(或以编程方式)指定它,并在ClientBaseAddress中使用不同的(额外)端口(可能被防火墙阻止)以使第二个http通道进行双工通信
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.