473,486 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

c# AsyncCallBack and COM+

We are developing a C# application using .Net
AsyncCallback delegates. The application currently
executes, as expected,
using these asynchronous methods. Once this application is
converted to a COM+ component (i.e. a .NET serviced
component) the program ceases to execute properly
and 'hangs' without asynchronously executing the callback
delegates. Any help with .Net asynchronous programming
under COM+ would be grealty appreciated.
Nov 15 '05 #1
2 1903
Rick,

You are not going to be able to do this. Switching threads in a context
(which is what you are doing), and then trying to access things outside of
the context are big no-nos. It is ok if you are accessing internal
information in the context, as you are responsible for it at that point, but
once you are trying to access other things that the context provides (for
example, transactioning services, etc, etc), COM+ doesn't know how to track
those threads.

You should marshal the calls back through the calling thread if you want
this to work.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rick Close" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
We are developing a C# application using .Net
AsyncCallback delegates. The application currently
executes, as expected,
using these asynchronous methods. Once this application is
converted to a COM+ component (i.e. a .NET serviced
component) the program ceases to execute properly
and 'hangs' without asynchronously executing the callback
delegates. Any help with .Net asynchronous programming
under COM+ would be grealty appreciated.

Nov 15 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Rick,

You are not going to be able to do this. Switching threads in a context
(which is what you are doing), and then trying to access things outside of
the context are big no-nos. It is ok if you are accessing internal
information in the context, as you are responsible for it at that point, but
once you are trying to access other things that the context provides (for
example, transactioning services, etc, etc), COM+ doesn't know how to track
those threads.

You should marshal the calls back through the calling thread if you want
this to work.

Hope this helps.


Or, you probably should be looking at the COM+ way of doing async calls.
I dont like it particularly though.

Or better still, take a peek at MSMQ stuff. That should help out.

--
Girish Bharadwaj

Nov 15 '05 #3

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

Similar topics

1
5189
by: Jim P. | last post by:
I'm having trouble returning an object from an AsyncCallback called inside a threaded infinite loop. I'm working on a Peer2Peer app that uses an AsyncCallback to rerieve the data from the remote...
11
3758
by: Doug Thews | last post by:
I've been working on some samples that use BeginInvoke/EndInvoke. In one example, I call BeginInvoke and pass it an AsyncCallback function pointer. I was messing around with ReaderWriterLocks and...
1
8256
by: Lenn | last post by:
Hi, I am using .BeginInvoke to make an asynchronous call to a function, and passing in a AsyncCallback, so client gets notification when method completes, relevant code is provided below: ...
3
9403
by: Lenn | last post by:
Hello, I have the following example of AsyncCallback from a C# book which I wanted to implement in my project: //Class with AsyncDelegate public class AsyncProcess { public AsyncProcess() {
1
6668
by: Alper AKCAYOZ | last post by:
Hello, I have developped asynchronous socket communication with blocking Socket commands (accept, connect, send, receive) by using threads on Windows .NET Forms. It is working properly. Now I...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
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...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6842
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...
0
7330
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...
1
4865
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...
0
3070
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...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.