簡體   English   中英

我的Windows應用程序找不到客戶端上Web服務API的參考合同的默認終結點元素

[英]My windows app can not find the default endpoint element for the reference contract to the web-service APIs on client-side

我的Windows桌面應用程序找不到客戶端上Web服務API的參考合同的默認終結點元素。

客戶端應用程序可以在Visual Studio IDE上正確執行,但是在客戶端環境中遇到了一些問題。

服務器和客戶端都是Windows操作系統,並且都在同一本地網絡上運行。

我試圖通過Chrome瀏覽器從客戶端到服務器端連接到Web服務,所以我認為我們可以假設沒有網絡問題。

如果這是與配置有關的問題,那么我應該如何處理配置文件?


我已經在互聯網上搜索了兩天。 但是這個問題仍然沒有解決。

來自客戶端app.config的代碼段:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="RemoteAccessWSSoap" maxReceivedMessageSize="2147483647" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:49172/RemoteAccessWS.asmx"
            binding="basicHttpBinding" bindingConfiguration="RemoteAccessWSSoap"
            contract="RemoteAccessWS.RemoteAccessWSSoap" name="RemoteAccessWSSoap" />
    </client>
</system.serviceModel>

服務器端Web.config中的代碼段:

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="WebService1Soap" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647" />
    <binding name="Service1Soap" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647" />
  </basicHttpBinding>
</bindings>

<client>
  <endpoint address="http://localhost:49172/RemoteAccessWS.asmx"
      binding="basicHttpBinding" bindingConfiguration="RemoteAccessWSSoap"
      contract="RemoteAccessWS.RemoteAccessWSSoap" name="RemoteAccessWSSoap" />
</client>

服務器端Web API的“ .asmx.cs”文件中的代碼段:

    [OperationContract(Name = "HelloWorld")]
    string HelloWorld();

    [OperationContract(Name = "AddDouble")]
    string AddDouble(string a, string b);

請幫我一個忙。 非常感謝。


錯誤訊息圖片

我用經驗豐富的同事的意見解決了這個問題。

他告訴我,我寧願將Web服務URI添加為“ Web引用”,而不是將其添加為Visual Studio IDE上的“服務引用”。

非常感謝你 !

暫無
暫無

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

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