Asp.net 访问iis中托管的wcf服务在localhost中工作,但如果通过ip:port/service.svc访问则不工作

Asp.net 访问iis中托管的wcf服务在localhost中工作,但如果通过ip:port/service.svc访问则不工作,asp.net,asp.net-mvc,wcf,Asp.net,Asp.net Mvc,Wcf,Web.config <behavior name="JobsServiceBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483646" /> <serviceMetadata httpGetEnabled = "true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFa

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。我在互联网和代理/防火墙上使用它时遇到了问题。我同意Juval Lowy在他的书(为WCF服务编程)中的话:“WSDualHttpBinding基本上是不可用的,因为实际上不可能穿越将服务与客户端分离的各种通信障碍,而且需要找到一个特定的web服务器,这使得这不切实际”。另见 我强烈建议您使用netcpbinding/netcprelaybinding(IIS/WAS hosing)

但是您可以尝试wsDualHttpBinding。我记得我的问题是在ClientBaseAddress中。AFAIK-您需要在客户端配置中指定它(或以编程方式),并在ClientBaseAddress中使用不同的(额外)端口(可被防火墙阻止)作为第二个http通道以双工方式进行通信