Remoting - Windows Service problem



Hi ,
I have a remote server which works fine. The Client ans server work with
no problem.

However when i convert the server to a windows service i run into problems.
The service installs fine and starts fine too. It also seems to register the
channels and create the well know types.

However when i try to access the server using the client it throws an
exception
"Exception has been thrown by the target of an invocation." This is
precisely thrown when the proxy object on the client tries to access a
property or method from the remote server. The server itself does not throw
any errors.

Below is the server code for OnStart.

Please can someone give me any clues of what could be happening?

protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
try
{

fs = new StreamWriter(new
System.IO.FileStream("C:\\temp\\mcTest.txt",FileMode.Append ));

BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary props = new Hashtable();
props["port"] = 8085;
TcpChannel myChannel = new TcpChannel(props, null, provider);
fs.WriteLine("port");

//register channel
ChannelServices.RegisterChannel(myChannel);

fs.WriteLine("RegisterChannel");


//Register services
RemotingConfiguration.ApplicationName = "AServer";
RemotingConfiguration.Configure(System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "AServer.exe.config");
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteObject),
"RemoteObject",
WellKnownObjectMode.Singleton);

fs.Close();
}
catch(Exception err)
{
if (fs !=null)
{
fs.Close();
}

fs = new StreamWriter(new
System.IO.FileStream("C:\\temp\\mcTest.txt",FileMode.Append));
fs.WriteLine(err.Message );
fs.Close();

}
finally
{
fs = new StreamWriter(new
System.IO.FileStream("C:\\temp\\mcTest.txt",FileMode.Append));
fs.WriteLine("finally" );
fs.Close();
}




}

.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)
  • Re: What doesnt lend itself to OO?
    ... > rather than client code. ... no way to do that without also touching the object with clock semantics ... will not encapsulate both clock semantics and network semantics. ... The server can do whatever it wants ...
    (comp.object)
  • RE: Fax monitor incoming + outgoing calls?
    ... problem between the client computer and the SBS server. ... Client is using the internal IP address of the SBS server as the ... To the folder redirection GPO issue: ...
    (microsoft.public.windows.server.sbs)

Loading