XML Web Service中混合托管代码与非托管代码
资料介绍:
附件1:外文资料翻译译文
01, 2004
XML Web Service中混合托管代码与非托管代码
使用web service封装器合并COM组件
Max I. Fomitchev
asp.NET web service中混合托管代码与非托管代码提供了一种有效的方法来封装MFC完全遵守.NET的XML web sercive代码
Max Fomitchev是.NET Programming with Visual C++一书的作者,你可以通过fomitchev@aDelphia.net与其联系
在《把C++COM 组件封装为XML Web Service》中我们讨论了把C++COM 组件作封装为XML Web Service[1]。根据上文的观点,曾经封装了一个大的COM组件做为一个ATL web service。尽管封装这种方法很不错,可是性能要求迫使我们追求更紧密的整合。决定使用ALT web service封装器来融合C++ COM组件。从而消除了间接共同类的初始化以及组件状态的序列化和非序列化。
由于性能提高了,虽然ATL 和MFC 代码混合在一起会有麻烦,但是还是值得考虑的。在用 ATL 网络服务合并 COM 组件的过程中,我们已经完全地删除了 COM 层并且创造了在功能上与前一个COM组件等同的静态的MFC库。 而不是一个单一的共同类,这个库包含了一些 MFC 类。
我们执行了一个特殊的保持类状态的方法来解决合并的副作用,因为标准的ISession和ISessionStateService接口需要执行一个繁重的类序列/非序列机制。相反,在静态存储器上使用了一个简单的内存定位机制。只要 ATL 网络服务 (本质上是ISAPI DLL) 留在存储器中,此类存储就会持续。 [资料来源:Doc163.com]
附件2:外文原文
01, 2004
Mixing Managed & Unmanaged Code in XML Web Services
Merging COMcomponents with web service wrappers
Max I. Fomitchev
Mixing managed and unmanaged code in asp.NET web services provides an efficient way to wrap MFC codeas fully .NET-compliant XML web services.
Max Fomitchev is the author of .NET Programming with Visual C++ and can be contacted at fomitchev@aDelphia.net.
In "Wrapping C++ COM Components as XML Web Services" [1] I discussed wrapping C++ COM components as XML web services. Following my own recipe, I've since wrapped a large COM component as an ATL web service. Although the wrapping went fine, performance requirements swayed me into pursuing even tighter integration. Therefore, I decided to fuse my C++ COM component with the ATL web service wrapper, thus eliminating the overhead of co-class initialization as well as serialization/deserialization of the component's state.
The resulting performance improvement was well worth the trouble of mixing and crushing together ATL and MFC code. In the process of merging the COM component with the ATL web service, I have completely eliminated the COM layer and instead created a static MFC library equivalent in functionality to the former COM component. Instead of a single co-class, the library contained several MFC classes. [资料来源:Doc163.com]
As a side effect of the merger, I implemented a unique way of persisting session state because standard ISession and ISessionStateService interfaces required implementing a cumbersome (and inefficient) class serialization/deserialization