473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exposing VB6 COM dll via WCF

I tried searching the forums for this already and didn't find anything. I
want to expose functionality from a vb6 COM component via a WCF service. I
am trying to evaluate if exposing this webservice and using a COM component
is scalable. I have heard there are problems with this revolving around the
apartment threading models.

I know COM dll's are STA and a WCF service is MTA. Since there is no way to
force a WCF service to be STA, I am expecting all my webservice calls to
block as they are forced through the STA pipe. However, this is not
happening and I am wondering why. To test, I have a web method that takes a
boolean parameter. the web method calls some functions from the COM
component and then if the parameter is true, it pauses the current thread,
otherwise it doesn't. I have two clients that hit the service at the same
time and while one is paused the other is constantly hitting the service. I
am expecting the second client to block while first one is paused. Can
anyone tell me why this isn't happening? Do I need to pause or perform some
long running process from within the COM component to see the behavior I am
talking about?

The end goal is to make sure exposing portions of this COM dll will scale if
called from within a WCF service. I have read articles like the following
that make me very cautious of doing this:

http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

If this is indeed a problem, does anyone know a work around like the one
above for WCF to preserve at least some scalability.
Jan 15 '08 #1
4 2512
"chriscap" <ch******@discu ssions.microsof t.comwrote in message
news:A1******** *************** ***********@mic rosoft.com...
>I tried searching the forums for this already and didn't find anything. I
want to expose functionality from a vb6 COM component via a WCF service.
I
am trying to evaluate if exposing this webservice and using a COM
component
is scalable. I have heard there are problems with this revolving around
the
apartment threading models.

I know COM dll's are STA and a WCF service is MTA. Since there is no way
to
force a WCF service to be STA, I am expecting all my webservice calls to
block as they are forced through the STA pipe. However, this is not
happening and I am wondering why. To test, I have a web method that takes
a
boolean parameter. the web method calls some functions from the COM
component and then if the parameter is true, it pauses the current thread,
otherwise it doesn't. I have two clients that hit the service at the same
time and while one is paused the other is constantly hitting the service.
I
am expecting the second client to block while first one is paused. Can
anyone tell me why this isn't happening? Do I need to pause or perform
some
long running process from within the COM component to see the behavior I
am
talking about?

The end goal is to make sure exposing portions of this COM dll will scale
if
called from within a WCF service. I have read articles like the following
that make me very cautious of doing this:

http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

If this is indeed a problem, does anyone know a work around like the one
above for WCF to preserve at least some scalability.
Scalability may not be your greatest problem. Has this COM component ever
been tested in a multi-threaded environment (especially, on a multiple CPU
system)? If it hasn't been tested in such an environment, then it may not
work in that environment. I've seen heap corruption problems and such from
COM components that claimed to be thread safe and were not.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Jan 16 '08 #2
No it has not been tested in a multi-threaded environment. Can you recommend
any resources to help detect this? Can you explain why this would be an
issue?

"John Saunders [MVP]" wrote:
"chriscap" <ch******@discu ssions.microsof t.comwrote in message
news:A1******** *************** ***********@mic rosoft.com...
I tried searching the forums for this already and didn't find anything. I
want to expose functionality from a vb6 COM component via a WCF service.
I
am trying to evaluate if exposing this webservice and using a COM
component
is scalable. I have heard there are problems with this revolving around
the
apartment threading models.

I know COM dll's are STA and a WCF service is MTA. Since there is no way
to
force a WCF service to be STA, I am expecting all my webservice calls to
block as they are forced through the STA pipe. However, this is not
happening and I am wondering why. To test, I have a web method that takes
a
boolean parameter. the web method calls some functions from the COM
component and then if the parameter is true, it pauses the current thread,
otherwise it doesn't. I have two clients that hit the service at the same
time and while one is paused the other is constantly hitting the service.
I
am expecting the second client to block while first one is paused. Can
anyone tell me why this isn't happening? Do I need to pause or perform
some
long running process from within the COM component to see the behavior I
am
talking about?

The end goal is to make sure exposing portions of this COM dll will scale
if
called from within a WCF service. I have read articles like the following
that make me very cautious of doing this:

http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

If this is indeed a problem, does anyone know a work around like the one
above for WCF to preserve at least some scalability.

Scalability may not be your greatest problem. Has this COM component ever
been tested in a multi-threaded environment (especially, on a multiple CPU
system)? If it hasn't been tested in such an environment, then it may not
work in that environment. I've seen heap corruption problems and such from
COM components that claimed to be thread safe and were not.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Jan 16 '08 #3
To reiterate, this is a vb6 component. I've only heard of heap corruption
from c++ when manually allocating memory. Is this still an issue with vb6?
I can't seem to find much on the topic.

"John Saunders [MVP]" wrote:
"chriscap" <ch******@discu ssions.microsof t.comwrote in message
news:A1******** *************** ***********@mic rosoft.com...
I tried searching the forums for this already and didn't find anything. I
want to expose functionality from a vb6 COM component via a WCF service.
I
am trying to evaluate if exposing this webservice and using a COM
component
is scalable. I have heard there are problems with this revolving around
the
apartment threading models.

I know COM dll's are STA and a WCF service is MTA. Since there is no way
to
force a WCF service to be STA, I am expecting all my webservice calls to
block as they are forced through the STA pipe. However, this is not
happening and I am wondering why. To test, I have a web method that takes
a
boolean parameter. the web method calls some functions from the COM
component and then if the parameter is true, it pauses the current thread,
otherwise it doesn't. I have two clients that hit the service at the same
time and while one is paused the other is constantly hitting the service.
I
am expecting the second client to block while first one is paused. Can
anyone tell me why this isn't happening? Do I need to pause or perform
some
long running process from within the COM component to see the behavior I
am
talking about?

The end goal is to make sure exposing portions of this COM dll will scale
if
called from within a WCF service. I have read articles like the following
that make me very cautious of doing this:

http://msdn.microsoft.com/msdnmag/is...10/WickedCode/

If this is indeed a problem, does anyone know a work around like the one
above for WCF to preserve at least some scalability.

Scalability may not be your greatest problem. Has this COM component ever
been tested in a multi-threaded environment (especially, on a multiple CPU
system)? If it hasn't been tested in such an environment, then it may not
work in that environment. I've seen heap corruption problems and such from
COM components that claimed to be thread safe and were not.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Jan 16 '08 #4
"chriscap" <ch******@discu ssions.microsof t.comwrote in message
news:D3******** *************** ***********@mic rosoft.com...
To reiterate, this is a vb6 component. I've only heard of heap corruption
from c++ when manually allocating memory. Is this still an issue with
vb6?
I can't seem to find much on the topic.
Heap corruption was just an example of one issue I've encountered before.
It's one instance of the general problem: "if you don't test it, then don't
expect it to work".

Unless VB6 takes special precautions to permit code that was not written for
a multi-threaded environment to work in a multi-threaded environment, then I
wouldn't expect it to work. Instead, I'd expect you to receive a number of
strange crashes and other failures over the lifetime of the application.
They may or may not seem to be related to the COM component, but they
actually will be.

I would recommend that you find another strategy that doesn't involve the
expectation that your VB6 component "just happens to work".

Otherwise, Good Luck!
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Jan 17 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2763
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object (implemented in mc++). In the constructor of the "main" object I want to initialize the property "Info" to null in a way that will make the c# programmer (the user) able to write: if (MyObj.Info==null) {..}
7
1722
by: J L | last post by:
I'm trying to expose only a limited set of method calls from a C# program to someone using my dll. The entire application is written in C# and my first attempt has been to try and write a COM object/interface. However, since the COM object references parts I don't want exposed, in order to use the DLLs in a new C# project the other .dlls must be added as references. Is there any way to prevent the methods in these other DLLs from being...
3
1264
by: FredC | last post by:
How do you make a program's properties and methods availale so that other programs can "connect" to them at design time and then use them at run time?
1
1230
by: David Dvali | last post by:
I have some basic questions please. What is the best way of exposing some protected properly of base class as public properly?
3
2156
by: bill | last post by:
I need to open a asp.net web form from a classic asp page, and pass a username and password to the asp.net page. The username and password exist as session variables in the classic asp application. I can't put the password in the classic asp page form as a hidden field and submit it, because someone can view source and see the password. This is a security problem I encounter in a mixed classic asp and asp.net environment. I don't...
8
1921
by: Dave A | last post by:
I have a class called 'PrimaryKey' that represents the primary key of a table. PrimaryKeys can only be created and the class only implements .ToString(). The PrimaryKey class internally stores the data as either a int or a Guid depending on the structure of the database. If we simply used int to represent a primary key, rather than this PrimaryKey class then programmers could do things like performing mathematically operations on the...
2
1196
by: Neil Cerutti | last post by:
I'm using doctest for the first time, and boy is it cool. But I'm nervous about exposing library internals in the docstring. def glk_cancel_char_event(win): """ Cancel a pending request for character input. win must be a valid Glk window.
4
7569
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed for performance not inheritance and, therefore, does not contain any virtual members. The following generic collections are designed for inheritance and should be exposed instead of System.Collections.Generic.List<T>. *...
1
3479
by: bantunks | last post by:
Hello, I am trying to figure out the advantages and disadvantages of exposing interfaces through Opaque data types in C. I have figured/found out the following two advantages 1. Higher level of abstraction 2. if the layout of the defined structure inside the source files changes, it will reduce/limit/minimize the amount of changes that may be needed in the code of the application that uses the library i.e. the library will itself handle...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.