Remoting and File Dirs  
Author Message
Netmaster0000





PostPosted: .NET Remoting and Runtime Serialization, Remoting and File Dirs Top

Hey Guys,
This is the problem. I have a remoting server i made. It exposes a few standard calls - SaveObject, DeleteObject, GetObject...etc. Now, this remoting server connects to a database, specified in it's config file, and carries out those operations. The case is, my remoting client, when compiled with the DLL is giving another drama. When i run my client and i attempt to call SaveObject, the server is going to attempt to load it's config file (not a literal .config file, it's an XML file), to get the connection path to the database. When my client attempts to do this, it seems as if it is using it's local dll file directory to find the config file. That should not be the case, only the listening server should be loading the config file and performing the operations. Why is my client attempting to do such from it's own local dir





.NET Development35  
 
 
VikasGoyal





PostPosted: .NET Remoting and Runtime Serialization, Remoting and File Dirs Top

hi this means .. you are getting a local instance of your remote objects. Remoting is not working.

can you pls post snippets of your client and service code.

http://DotNetWithMe.blogspot.com
vikas goyal



 
 
Netmaster0000





PostPosted: .NET Remoting and Runtime Serialization, Remoting and File Dirs Top

Ok. Heres a client code snippet
<code>
/* client code snippet */
namespace RemotingClient_Test1
{
/// <summary>
/// Test client for remoting
/// </summary>
class Class
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
RemotingConfiguration.Configure("RemotingClient_Test1.exe.config");
TServiceObjectManager_SS aManager = new TServiceObjectManager_SS();

TUser aUser = new TUser();
aManager.SaveObject(aUser);
Console.WriteLine(aUser.POK);
Console.ReadLine();
}
}
}


/* client config snippet */
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="TServiceObjectManager_SS, TServiceObjectManager_SS" url="http://localhost:8989/TServiceObjectManager_SS.rem" />
</client>
</application>
</system.runtime.remoting>
</configuration>

/* listener snippet */
namespace uServiceObjectManager_SS_Listener
{
/// <summary>
/// Listener for remoting client
/// </summary>
class TServiceObjectManager_SS_Listener
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
RemotingConfiguration.Configure("uServiceObjectManager_SS_Listener.exe.config");
Console.WriteLine ("Listening for requests. Press Enter to exit...");
Console.ReadLine();
}
}
}

/* remote object snippet */
namespace uServiceObjectManager
{
/// <summary>
/// The purpose of this class is to handle the management of
/// Primative Object Managers and how they interact with service calls
/// </summary>
public class TServiceObjectManager : TPrimativeObjectManager
/*eventually descends from MarshalByRefObject */
{...
/*
Method saves an object using it's designated manager


*/
public override bool SaveObject(TDBObjectParent anObject)
{
System.Windows.Forms.MessageBox.Show(Environment.CurrentDirectory);
anObject.POK="497E184D-B5DE-4A19-88FB-2C483519A61E";
return true;
//return base.SaveObject(anObject);
}

}
}

/* remote config snippet */
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="Singleton" type="TServiceObjectManager_SS, TServiceObjectManager_SS" objectUri="TServiceObjectManager_SS.rem" />
</service>
<channels>
<channel ref="http" port="8989"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>

</code>


 
 
johnedw





PostPosted: .NET Remoting and Runtime Serialization, Remoting and File Dirs Top

Hi NetMaster, I would suggest you use an interface on the client side. Use the interface as a Proxy DLL between server and client.

This may help with your current issue, as the client will only care about the signature, the parameters and return values, and let the .NET Runtime do the serliazation(unless you have some special things you need to have custom serialization for).

Thanks,

John