Click to See Complete Forum and Search --> : .NET Events simple question


arisp
July 31st, 2002, 03:43 PM
Hi all... I will get straight to the point and, as always, any replies will be greatly appreciated...

I have a web service and I want to make it an event producer... other components (windows services) will then subscribe and listen for these events..

The problem is, all the examples I found, and followed, assume that on the listener side, you create a new eventproducer object in order to listen for the events it raises. But this is a web service. I tried making the Event in my webservice shared, but no luck, it does not appear to be fired.. or at least the listener does not catch it...

Anybody got any ideas on how to go about doing this?

Thanks guys,
AP

DSJ
July 31st, 2002, 04:54 PM
There are several of us here working on the same problem it seems. This was easy to do with a Multiuse ActiveX EXE in VB 6, but there doesn't seem to be an obvious equivalent in .NET. Currently I'm studying the "Object Pooling" concept to see if the answer lies there. If you find anything, please post it!

Thanks!

DSJ
August 1st, 2002, 01:58 PM
I finally got a simple example to work, this process will start with the first application that requests it and end when the last reference to it is lost. It returns the same shared object to all Callers:

Imports System.EnterpriseServices
Imports System
Imports System.Windows.Forms
Imports System.Reflection
'Sets the assembly Name
<Assembly: ApplicationName("Svr1")>

'***** KEY TO Out-of-Process
'Tells it this is an out-of-Process server
'The other option is Library with means create in-process
<Assembly: ApplicationActivation(Activationoption.Server)>
'Key pair used to sign the assembly
<Assembly: AssemblyKeyFile("c:\net\svr\Svr1.snk")>

Public Class SvrCls
Inherits ServicedComponent
Shared m_Var As String
Shared Sub New()

End Sub
Public Property VarValue() As String
Get
VarValue = m_Var
End Get
Set(ByVal Value As String)
m_Var = Value
End Set
End Property
End Class

arisp
August 1st, 2002, 02:34 PM
Thanks dude... I will try it tonight and let you know..

Kind regards,
AP

arisp
August 1st, 2002, 07:51 PM
How would you apply that to a web service though??

Kind regards,
AP

DSJ
August 2nd, 2002, 09:59 AM
Don't know... never created a web service.