问题描述
我有一个 VB6 应用程序,我想与我编写的导入安全证书的 WCF Windows 服务进行通信.服务中唯一的函数采用两个字符串参数.然而,我一直很难让这两个程序进行通信.
I have a VB6 application that I want to communicate with a WCF Windows Service that I have written which imports Security Certificates. The only function in the service takes two string arguments. I have been having a lot of difficulty getting the two programs to communicate however.
在 VB.NET 中,这很容易,只需像使用 Web 服务一样引用该服务即可.然而,在 VB6 中,事情似乎并不那么简单.搜索似乎只提取了如何在 VB6 中编写 Windows 服务的示例.
In VB.NET, it is easy, just make a reference to the service as you would a web service. In VB6, however, it is not so simple it seems. Searching only seems to pull up examples of how to WRITE a Windows service in VB6.
有人知道这是怎么做到的吗?
Anyone know how this is done?
推荐答案
我发现从 VB6 访问 WCF 服务的最简单方法是为服务客户端创建一个 .Net ComObject 包装器.然后在 VB6 中,您所做的就是创建对象并在该对象上调用一些方法.所有 WCF 工作都在 .Net com 对象中进行.
The easyest way I have found to access a WCF service from VB6 is to create a .Net ComObject wrapper for the service client. Then in VB6 all your are doing is a create object and calling some methods on the object. All the WCF work takes place in the .Net com object.
这篇关于在VB6中与WCF Windows服务通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!