簡體   English   中英

通過互聯網的wcf服務wsHttpBinding

[英]wcf service wsHttpBinding over internet

您好,嘗試讓我綁定到互聯網上。 即時通訊使用wsHttpBinding並嘗試使其與肥皂一起使用。 我已經嘗試過NetTcpBinding,並使用我的公共IP在wcftestclient上顯示了我的函數,並且將端口移植到了正確的計算機上,但是我無法調用任何失敗的函數: 在此處輸入圖片說明

而且我不認為肥皂可以與NetTcpBinding一起使用,所以我一直在嘗試使此配置有效

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service
        behaviorConfiguration="VenatoWCF.Behavior"
        name="VenatoWCF.WCFService">
        <endpoint
          address=""
          binding="wsHttpBinding"
          contract="VenatoWCF.IService"
          bindingConfiguration="Binding">
        </endpoint>
        <endpoint
          address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange">
        </endpoint>

        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8734/WCF/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="VenatoWCF.Behavior">
          <serviceMetadata httpGetEnabled="true" />
          <useRequestHeadersForMetadataAddress />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="Binding" >
          <security mode="Message">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>
</configuration>

這可以被soap消耗,但是這個配置我無法通過soap或wcftestclient獲得任何響應。

肥皂:致命錯誤:未捕獲的SoapFault異常:[WSDL] SOAP錯誤:解析WSDL:無法從' http://(我的外部ip):8734 / WCF /?wsdl'加載:無法加載外部實體“ http ://((我的外部IP):8734 / WCF /?wsdl“

謝謝你的回答

EDIT1對不起,誰能以足夠快的速度查看:/的配置文件

編輯2

在我的wsdl文件中發現,在底部我有<soap:address location="https://dendei:8734/WCF/" />這也意味着應該是一根肥皂也要連接,因此必須為"https://(my external ip):8734/WCF/" ???

我該如何更改? 在配置文件? 還是在我的程序中?

編輯3

在搜索UseRequestHeadersForMetadataAddressBehavior時偶然發現了此網站

那解決了它的本地化,所以我可以在我的基本地址中有本地主機<add baseAddress="https://localhost:8734/WCF/"/>

它用肥皂工作,所以我也得到了它嘗試連接的地址

並通過網絡工作:)

但是必須使用UseRequestHeadersForMetadataAddressBehavior才能使用.NET 4.0

您的錯誤消息說您使用此URL http://(My External ip):8734/WCF/?wsdl使用WcfTestClient連接到您的服務。 但是,您在配置文件中定義了其他網址。 看看您的baseAddress。 試試這個網址http://(My External ip):8734/Venato/mex?wsdl

如果我切換到4.0並使用UseRequestHeadersForMetadataAddressBehavior而不是嘗試訪問wsdl文件並更改指向本地地址的soap:address,它仍然可以正常工作,它仍然不知道該怎么做。 :)

並且連接問題是在我的計算機防火牆中阻止了連接,路由器接受了連接,而我自己的計算機將其阻止了xD

將使用對我很高興的配置來編輯我的任務!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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