簡體   English   中英

訪問iis中托管的wcf服務可在localhost中運行,但如果通過ip:port / service.svc訪問則無法運行

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM