I was writing simple test program for using class libraries (OS: Windows 2003 Server). The problem I’ve got: runtime error:
-------------------------------------------
An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll
Additional information: Remoting configuration failed with the exception System.IO.FileNotFoundException: File or assembly name System.Runtime.Remoting, or one of its dependencies, was not found.
File name: "System.Runtime.Remoting".
------------------------------------------
Configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<System.Runtime.Remoting>
<application name="BasicRemotingClient">
<channels>
<channel
type="System.Runtime.Remoting.Channels.Http.HttpCh annel,System.Runtime.Remoting" />
</channels>
</application>
</System.Runtime.Remoting>
</configuration>
Client: (BasicRemotingClient.cs)
using System;
using System.Runtime.Remoting;
using BasicServer;
namespace BasicClient
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class BasicRemotingClient
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Type type=typeof(BasicRemotingServer);
String url="http://localhost/BasicServiceDemo/BasicRemotingServer.soap";
RemotingConfiguration.Configure(@"D:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\C#\BasicClient\BasicRemotingClient.exe.co nfig");
BasicRemotingServer brs=(BasicRemotingServer)Activator.GetObject(type, url);
Console.WriteLine(brs.getServerResponse());
}
}
}
Server: (BasicRemotingServer.cs)
using System;
namespace BasicServer
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class BasicRemotingServer: MarshalByRefObject
{
/// <summary>
/// The main entry point for the application.
/// </summary>
public string getServerResponse()
{
return "Greetings from the BasicRemotingServer component!";
}
}
}
The error occurs at Activator.GetObject(…) .
What is wrong and how to correct it?