|
|
|
date: Mon, 10 Oct 2005 08:49:33 -0700,
group: microsoft.public.dotnet.myservices
back
Marshalling a DLL Class ByRefObject via a Service Application
I'm trying to implement a 2-tier configuration, providing access to a DLL
class on the server. I have a DLL written in VB.NET containing one class,
residing on the server. At the class level, it has:
Inherits MarshalByRefObject
I also have a standard application on the server, designed to marshal the
class to the world. It references the DLL class and contains one module.
In Sub Main(), it contains:
Dim channel As New TcpChannel(50000)
ChannelServices.RegisterChannel(channel)
Dim MyObj As New <ClassName>()
RemotingServices.Marshal(MyObj, "ClassName.rem")
This scenerio works fine, providing access to the DLL class across the
network; however, when I attempt to implement this same thing in a service
application (with the latter four lines included in the Start routine), the
service application installs, but fails to start. It gets stuck in a
"Starting" condition and the server must be rebooted. Is there a trick to
setting this up in a service application?
date: Mon, 10 Oct 2005 08:49:33 -0700
author: Phil Galey am
Re: Marshalling a DLL Class ByRefObject via a Service Application
Phil Galey wrote:
> I'm trying to implement a 2-tier configuration, providing access to a DLL
> class on the server. I have a DLL written in VB.NET containing one class,
> residing on the server. At the class level, it has:
>
> Inherits MarshalByRefObject
>
> I also have a standard application on the server, designed to marshal the
> class to the world. It references the DLL class and contains one module.
> In Sub Main(), it contains:
>
> Dim channel As New TcpChannel(50000)
> ChannelServices.RegisterChannel(channel)
> Dim MyObj As New <ClassName>()
> RemotingServices.Marshal(MyObj, "ClassName.rem")
>
> This scenerio works fine, providing access to the DLL class across the
> network; however, when I attempt to implement this same thing in a service
> application (with the latter four lines included in the Start routine), the
> service application installs, but fails to start. It gets stuck in a
> "Starting" condition and the server must be rebooted. Is there a trick to
> setting this up in a service application?
I remote in services all the time, but I do so over GenuineChannels.
I don't recall seeing this with remoting, but then it sounds similar to
another issue. I always use a domain user for the service since nearly
everything my services do requires network access. I think remoting is
considered a network access, so it may not work using the local service
account, which is default.
The stuck may be due to the app model, typically, win apps throw message
boxes for some problems. If you convert a win-app to a service, and
don't take care of this, it may be throwing a message box, which will be
hidden, and wait for ever for a response to it. I can't imagine remoting
itself causing the hang you see.
HTH - Lee
date: Mon, 10 Oct 2005 13:56:59 -0700
author: Lee Gillie
|
|