472,958 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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
"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",FileMo de.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.C urrentDomain.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",FileMo de.Append));
fs.WriteLine(err.Message );
fs.Close();

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


}

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 1249
A Windows Service does not run in the same namespace.
Aug 16 '06 #2

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

Similar topics

0
by: Linesh Gajera | last post by:
Hi, I have unique problem. I have configured RemotingServer running as Console Application and my Remoting object access Oracle database. My remoting object make call to Oracle database and...
15
by: anders | last post by:
Hi! I have a config file that looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.runtime.remoting> <application> <service> <wellknown mode="SingleCall"...
2
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
12
by: Mural Kumar via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Mural Kumar Which is the best way to make a remoting server? 1)As a Windows service 2)As a simple exe, which will run in a...
5
by: LGHummel | last post by:
I'm trying to host a remoting app in IIS and am getting the following error: Failed to execute the request because the ASP.NET process identity does not have read permissions to the global...
2
by: Stephajn Craig | last post by:
Is it possible to apply remoting techniques to a Windows Service Application? I have an application that I'm building that is primarily ASP.NET based. However, there are some functions that I...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
0
by: Jason | last post by:
Ok, for the life of me, I just don't understand what's going on. I want to use remoting to send messages from a windows service to a windows form app, but I just can't get it to work. So, here's...
8
by: nyhetsgrupper | last post by:
I have written a windows service and want to expose a web based user interface for this service. I then wrote a class library containing a ..net remoting server. The class library have a method...
13
by: José Joye | last post by:
Hello, What is the best way to stop a remoting server (Singleton SAO) that has been started with RemotingConfiguration.Configure(). For sure, I want to do this without quitting the application...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.