.Net 1.1 客户端可以调用 .Net 2.0 Web 服务吗?如果是这样,怎么办?
我们终于将我们的 Web 服务从 .Net 1.1 升级到 .Net 2.0/3.5。调用这些 Web 服务的客户端之一作为 Windows 服务运行。客户站点的服务器升级后,Windows 服务可能要过一段时间才会升级。
是否可以管理我的 .Net 2.0 Web 服务,以便它们正确地为来自 .Net 1.1 客户端的调用提供服务?在我的测试环境中,我从 .Net 1.1 客户端连接到 .Net 2.0 Web 服务,并收到来自 IIS 的 401.1 错误。 Web 服务设置为匿名访问。从 .Net 2.0 客户端连接到 .Net 2.0 Web 服务时,可以使用相同的凭据。
谢谢你的帮助,
-科林-
We have finally upgraded our web services from .Net 1.1 to .Net 2.0/3.5. One of the clients that calls these web services is run as a windows service. It is probable that the windows service will not be upgraded until some time after upgrading the server at customer sites.
Is it possible to massage my .Net 2.0 web services so they will correctly service the calls from the .Net 1.1 client? In my test environment, I connect to the .Net 2.0 web service from a .Net 1.1 client and I receive a 401.1 error from IIS. The web service is set to anonymous access. The same credentials work when connecting to the .Net 2.0 web service from a .Net 2.0 client.
Thanks for your help,
-colin-
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Web 服务应该是平台中立的。如果您的 Web 服务编写正确,那么任何支持 SOAP 1.1 的平台上的任何客户端都应该能够使用它。
如果您的服务返回或接收特定于 .NET 的类型,则可能出现这种情况。例如,如果您发送或接收 DataSet,则可能会出现问题 - DataSet 不仅特定于 .NET,而且还特定于 .NET 的特定版本。 .NET 1.1 和 .NET 2.0 之间的 XML 和 XML 序列化领域发生了许多变化,您最终可能会看到这些问题之一。
但我认为其中任何一个都不应该给你带来 401 错误。查看事件日志,看看是否有关于该错误的有趣内容。
Web services are meant to be platform-neutral. If your web service was written properly, then any client, on any platform supporting SOAP 1.1, should be able to consume it.
One place where this can fall down is if your service is returning or receiving types specific to .NET. If you send or receive a DataSet, for instance, then there can be problems - DataSet is specific not only to .NET, but also to specific versions of .NET. There were many changes made in the area of XML and XML Serialization between .NET 1.1 and .NET 2.0, and you could eventually see one of those problems.
But I don't think any of those should get you a 401 error. Look into the event log and see if anything interesting was written about that error.
这取决于服务。如果 .NET 2.0 服务:
DataSets
等)然后它是兼容的。
如果您收到 401.1 错误,但与同一台计算机上的其他客户端连接没有问题,那么我的猜测是该服务需要 SOAP 标头中的某些内容。 它在期待什么,我无法立即告诉你;我必须查看服务代码/配置。
或者,这可能只是 Web 服务器上的配置问题。如果没有有关可以/无法连接的特定环境的更多详细信息,很难说。
It depends on the service. If the .NET 2.0 service:
DataSets
, etc.)Then it's compatible.
If you're getting a 401.1 error, but have no problem connecting with other clients from the same machine, then my guess is that the service is expecting something in the SOAP headers. What it's expecting, I can't tell you offhand; I'd have to see the service code/configuration.
Alternatively, it might just be a configuration issue on the web server. Without more details about the specific environments that can/cannot connect, it's hard to say.
正如 @Aaronaught 所写,错误可能是服务期望 SOAP 标头中包含某些内容。要对此进行分析,您可以验证生成的 wsdl(展开 Web 引用的所有文件)或通过 svcutil.exe 下载元数据。这将生成一个代理,用于调用网络服务。
这样,您就可以更好地控制代理。
如何使用 svcutil 的示例:
As @Aaronaught wrote, The error can be that the service is expecting something in the SOAP headers. To analyse this, you could verify the wsdl generated (expand all files of web reference) or download the metadata via svcutil.exe. This will generate a proxy, that is used to call the web-service.
That way, you have more control over the proxy.
Example on how to use svcutil:
感谢您的回复。他们有助于进一步诊断它不起作用的原因。事实证明,一切正常,401.1 响应具有误导性(但正确)。我们的问题是由于 Web 服务目录结构的更改造成的。如果我能更加集中注意力,我可能会在问这个问题之前就发现了这一点。
回答我的问题:是的。 .Net 1.1 客户端可以调用 .Net 2.0 Web 服务,通常不需要额外的配置。只需确保您的 URI 正确即可。
Thank you for your responses. They were helpful in further diagnosing why it wasn't working. It turns out that everything does work and that the 401.1 response was misleading (but correct). Our problem was due to a change in the web services directory structure. Had I been paying better attention, I might have caught it before asking this question.
To answer my question: Yes. A .Net 1.1 client can call a .Net 2.0 web service and, in general, no additional configuration is necessary. Just make sure you're URI is correct.