Jan 3, 2010

How to host a remote object in IIS server(1)

Requirements
1.Microsoft Visual Studio
2.IIS server

1.Building a simple remote object

using System;
using System.Runtime.Remoting;
namespace HelloWorldObject
{
public class Hello:MarshalByRefobject
{
public string HelloWorld(string str)
{
return "HelloWorld received"+str+"from client";
}
}
}

Hello.cs နဲ႔ remote object တစ္ခုလုပ္ပါ။

2.Host the remote object in IIS server



1.Create new folder called "HelloWorldWeb" in C:\Inetpub\wwwroot\ .
2.Create a sub folder named "bin" in this "HelloWorldWeb".
3.HelloWorldObject.dll ဖုိင္ကုိ Visual Studio မွေကာ္ပီကူးပါ။ "bin" folder အထဲကုိထည့္ပါ။
4.Web.config ဖုိင္ကုိေရးပါမယ္။ notepad မွာေရးျပီး Web.config နဲ႔ သိမ္းပါ။

<?xml version="1.0" encoding="utf-8" ?>
< configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
< system.runtime.remoting>
< application>

< service>
< wellknown mode="Singleton" type="HelloWorldObject.Hello,HelloWorldObject"
objectUri="SimpleHelloWorld.soap" />
</service>
< channels>
< channel ref="http" />
< serverProviders>
< formatter href="binary" />
</serverProviders>
</channels>
</application>
</system.runtime.remoting>
</configuration>

5.Start => Programs => Administrative Tools => Internet Service Manager
6.In tree view ... go to Internet Information Services => local computer => Web Sites =>Default Web Site => HelloWorldWeb
7.Right click on it and choose Properties => in Directory tab => Create => Apply
8.Then virtual directory is created.

No comments:

Post a Comment