471,050 Members | 1,105 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,050 software developers and data experts.

Remoting - WIndows Service problem

Hi ,
Sorry i am posting this again as no one seems have taken notice of this
in the distributed appln forum

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 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.

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

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

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

//register channel

//Register services
RemotingConfiguration.ApplicationName = "AServer";
RemotingConfiguration.Configure(System.AppDomain.C urrentDomain.BaseDirectory.ToString() + "AServer.exe.config");
RemotingConfiguration.RegisterWellKnownServiceType (

catch(Exception err)
if (fs !=null)

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

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


Was this post helpful to you?

Why should I rate a post?

Expand AllCollapse All
Manage Your Profile |Legal |Contact Us |MSDN Flash Newsletter
Aug 16 '06 #1
1 1171
A Windows Service does not run in the same namespace.
Aug 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Linesh Gajera | last post: by
15 posts views Thread by anders | last post: by
12 posts views Thread by Mural Kumar via .NET 247 | last post: by
5 posts views Thread by LGHummel | last post: by
2 posts views Thread by Stephajn Craig | last post: by
reply views Thread by Jason | last post: by
8 posts views Thread by nyhetsgrupper | last post: by
reply views Thread by leo001 | last post: by

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.