【问题标题】: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 参考合同的默认端点元素
【发布时间】:2017-06-07 16:38:31
【问题描述】:

我的 Windows 桌面应用程序找不到客户端 Web 服务 API 参考合同的默认端点元素。

客户端应用可以在Visual Studio IDE上正确执行,但是在客户端的环境中遇到了问题。

服务器和客户端都是 Windows 操作系统,都运行在同一个本地网络上。

我尝试使用 Chrome 浏览器从客户端连接到网络服务,所以我认为我们可以假设没有网络问题。

如果这是与配置有关的问题,那么我应该如何处理配置文件?


我在互联网上搜索了两天。 但是这个问题一直没有解决。

客户端app.config中的sn-p:

<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 的 sn-p :

<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' 文件的 sn-p:

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

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

请帮我一个忙。非常感谢。


Error Message Image

【问题讨论】:

  • 你能发布你得到的完整错误吗?

标签: c# asp.net windows web-services service-model


【解决方案1】:

我根据经验丰富的同事的意见解决了这个问题。

他告诉我,我宁愿将 Web 服务 URI 添加为“Web 引用”,而不是将其添加为 Visual Studio IDE 上的“服务引用”。

非常感谢!

【讨论】:

    猜你喜欢
    • 2020-03-20
    • 1970-01-01
    • 2018-07-09
    • 2012-01-22
    • 2013-06-29
    • 1970-01-01
    • 2010-11-28
    相关资源
    最近更新 更多