WCF无法连接到ASMX Web服务
问题描述:
我现在正在使用WCF连接到远程Web服务(asmx)进行测试。远程Web服务目前是不安全的(没有https,没有用户名,密码)。我可以添加WCF服务引用,并且生成的所有类都可以。当我打电话给webservice时,它只是挂起。WCF无法连接到ASMX Web服务
所以我可以连接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>
答
请求wsdl端点不会触发创建服务实例。如果您使用的是自定义服务主机工厂,请查看该服务实现的构造函数或调试服务方法本身。
+0
嗯,这是一个初级代表队的回答“检查基本的东西”。但鲁本斯法里亚斯从未回来,所以你得到了信用。无论如何,我非常感谢您花时间回答。 – infocyde 2010-02-17 15:36:55
您不会绕过代理,并且客户端请求会在调用该操作并假定使用默认代理时假定您的身份。配置文件似乎很好,只有我能想到的是代理,但这并不能解释简单的“挂起”(假设你创建了一个代理实例) – kd7 2010-01-21 20:17:46
本文档对您有用吗? http://nayyeri.net/integrating-wcf-clients-with-asmx-services – 2010-01-21 20:20:03
感谢bnkdev和鲁本斯,迄今没有运气。我尝试使用像上面的链接那样的服务util来生成代理,并尝试连接,但仍然挂起。必须是某种网络问题。错误地告诉我,我可以用SOAP-UI连接。如果生成的代码实际上像广告一样工作,那就好了) – infocyde 2010-01-21 21:09:18