I have built the application as follows. But i'am getting an error as "The remote server returned an error: (404) Not Found". Can anyone tell how to correct that error. Please help me out.
Build a Simple Remote Object
Hello.cs(Class library)
using System;
using System.Runtime.Remoting;
namespace HelloWorldObject
{
public class Hello : MarshalByRefObject
{
public string HelloWorld(string str)
{
return "Hello World received " + str + " from the client";
}
}
}
Add references to the following:
1) System.Runtime.Remoting
Host the Remote Object in Microsoft Internet Information Services
1) Create a new directory called HelloWorldWeb (preferably under \Inetpub\wwwroot\).
2) Create a directory named bin beneath the HelloWorldWeb directory.
3) Copy the HelloWorldObject.dll file from the HelloWorldObject\bin\debug\ directory to the HelloWorldWeb\bin\ directory.
4) Use Notepad.exe to create a new file called Web.config. Copy the following text, and then save it in the HelloWorldWeb directory: web.config
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall">
type="HelloWorldObject.Hello, HelloWorldObject"
objectUri="SimpleHelloWorld.soap" />
</wellknown></service>
</application>
</system.runtime.remoting>
</configuration>
5) Click Start, point to Programs, and then click Administrative Tools. Open Internet Services Manager.
6) Create a virtual directory in IIS.
7) Make the virtual directory alias SimpleHello, and then set the source directory to the HelloWorldWeb directory.
Build a Simple Console Application to Test the Remote Object
TestClient.cs(Console application)
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Services;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
using HelloWorldObject;
namespace Client
{
class TestClient
{
[STAThread]
static void Main(string[] args)
{
HttpChannel http = new HttpChannel();
ChannelServices.RegisterChannel(http);
Hello obj = (Hello)Activator.GetObject(typeof(Hello),"http://localhost/SimpleHello/SimpleHelloWorld.soap");
Console.WriteLine(obj.HelloWorld("CLIENT APPLICATION"));
}
}
}
Add references to the following:
1) System.Runtime.Remoting
2) HelloWorldObject.dll (by browsing to the location of the .dll file)