WCF 无法连接到 ASMX Web 服务

发布于 2024-08-18 21:40:43 字数 1638 浏览 1 评论 0原文

此时,我正在使用 WCF 连接到远程 Web 服务 (asmx) 进行测试。远程 Web 服务目前不安全(没有 https、没有用户名、密码)。我可以添加 WCF 服务引用,并且所有类都生成正常。当我调用网络服务时,它就挂起了。

这样我就可以连接 SOAP UI 工具并返回数据了。我认为我的绑定有问题。有人看到我缺少的东西吗?

  <system.serviceModel>
    <bindings>
      <!-- Need to change some settings here for HTTPS and Basic Auth when those go online-->
      <basicHttpBinding>
        <binding name="ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://<snip>/Service.asmx"
          binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
          contract="PRIOrderService.ServiceSoap" name="ServiceSoap" />
    </client>
  </system.serviceModel>

I'm using WCF to connect to a remote web service (asmx) for testing at this point. The remote web service is unsecured for now (no https, no user name, password). I can add the WCF service reference, and all the classes are generated ok. When I make the call to the webservice, it just hangs.

So I can connect with the SOAP UI tool and return data just fine. I'm thinking it is something wrong with my binding. Anyone see anything I'm missing?

  <system.serviceModel>
    <bindings>
      <!-- Need to change some settings here for HTTPS and Basic Auth when those go online-->
      <basicHttpBinding>
        <binding name="ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://<snip>/Service.asmx"
          binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
          contract="PRIOrderService.ServiceSoap" name="ServiceSoap" />
    </client>
  </system.serviceModel>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗琴音 2024-08-25 21:40:43

请求 wsdl 端点不会触发服务实例的创建。如果您使用的是自定义服务主机工厂,请查看它,否则请查看服务实现的构造函数或调试服务方法本身。

Requesting the wsdl endpoint does not trigger a creation of the instance of your service. If you are using a custom service host factory look at that, otherwise look at the constructor of your service implementation or debug the service method itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文