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 / New Users / June 2007

Tip: Looking for answers? Try searching our database.

.NET Remoting works only once

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
eusebiu - 07 Jun 2007 12:48 GMT
Hello...
I am implementing .NET remoting with a WebService as client. All works
fine the first time, but when I call again the method from WS that
gets the remote object and calls a remote method, I don`t get into the
method(I've put a breakpoint in it... and it stops only the first
time...).

The second time I get to this line... and ... it stops... no
exeption.. no nothing..
remoteObject.Test();
where
remoteObject = Activator.GetObject(typeof(Remotable), location) as
Remotable;

I`ve implemented a Singleton pattern for a Class in WS like this :
interface ISingleton
{        void Test();      }
internal class Singleton : ISingleton
{
       Singleton(){}

       public static Singleton Instance
       {
           get
           {
               return Nested.instance;
           }
       }

       class Nested
       {
           internal static readonly Singleton instance = new
Singleton();
       }
       public void Test()
       {//call the remote method... }
}
public class WebService : System.Web.Services.WebService, ISingleton
   {
       public PixelWebService()
       {
           InitializeComponent();
       }

       [WebMethod]
      public void Test()
      {
            Singleton.Instance.Test();
      }
}

when calling the WS, I make :

WebService service = new WebService();
service.Test();

Can someone help me?
Thanks
eusebiu - 07 Jun 2007 17:12 GMT
Well... I made it work...
On WS - Global.asax :
protected void Application_Start(Object sender, EventArgs e)
{
           TcpChannel channel = new TcpChannel();

           if (ChannelServices.GetChannel(channel.ChannelName) ==
null)
           {
               ChannelServices.RegisterChannel(channel, false);

               RemotingConfiguration.RegisterWellKnownClientType(

typeof(ServiceClass),"tcp:\\localhost:8082\ServiceApplication\MyUri");
           }
}

The Server config file:
<?xml version="1.0"?>
<configuration>
 <system.runtime.remoting>
   <application name="ServiceApplication">
     <service>
       <wellknown type="RemotableLibrary.Remotable, RemotableLibrary"
mode="SingleCall" objectUri="MyUri"/>
     </service>
     <channels>
       <channel ref="tcp" port="8082">
         <serviceProviders>
           <formatter ref="binary" typeFilterLevel="Full"/>
         </serviceProviders>
       </channel>
     </channels>
   </application>
 </system.runtime.remoting>
</configuration>

This works only if the wellknown mode is SingleCall.

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.