Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / August 2006

Tip: Looking for answers? Try searching our database.

Remoting - Windows Service problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Remy De Almeida - 11 Aug 2006 16:04 GMT
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();
}

           

           
        }
MrKazoo - 24 Aug 2006 08:06 GMT
Hey Remy,

I just got back from vacation and saw your post.
Have you got this worked out by now?

> Hi ,
>     I have a remote server which works fine. The Client ans server work with
[quoted text clipped - 73 lines]
>            
>         }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.