How to host remote objects in IIS

Source: Internet
Author: User

How to host a remote object in IIS

 

1. Build a simple remote object

. Net remoting provides multiple ways to making an object remotable. they can be passed by value or by reference. after an object is passed by value, a copy of it exists in the program domains of both client and the server.

 

On the other hand, if an object is passed by reference to the client program, it exists only on the server. clients must access its methods through the reference. to do this, we must derive the remote class from the specified albyrefobject class in the system namespace.

 

2. host the remote object in IIS

At first, you need create a new directory where the remote object will be placed. then create a directory named bin beneath the above directory and copy the compiled remote object (DLL) to the bin directory.

In the meanwhile, this directory shocould be configured to be an application folder in IIS.

 

In the next step, create a new file called Web. config. The sample content is listed below.

<? XML version = "1.0" encoding = "UTF-8"?>

<Configuration>

<Deleetask>

......

</Appsettings>

<System. runtime. remoting>

<Application>

<Channels>

<Channel ref = "HTTP"/>

</Channels>

<Service>

<Wellknown

Mode = "singlecall"

Type = "appremotinglogger. businessrules. defaulthome, appremotinglogger. businessrules"

Objecturi = "appremotinglogger. ihome. Soap"/>

</Service>

</Application>

</System. runtime. remoting>

</Configuration>

 

It's important to note that if you are hosting your remote object in IIS, You can't declare an application name using Application name attribute in web. config file. in this case, the virtual directory of your application automatically becomes the application name.

 

Elements of configuration file:

<Wellknown

Mode = "singlecall"

Type = "businessrules. defaulthome, businessrules"

Objecturi = "ihome. Soap"/>

 

<Wellknown>Element contains information about server-activated (well-known) objects the application exposes to clients.ModeAttribute states whether the server offers a singleton or singlecall object. Its value can be either "Singleton" or "singlecall ".

TheTypeAttribute is used to state the name of the type being offered, and the Assembly or program in which it exists.

TheObjecturiAttribute specifies the URI endpoint where the remote object is to be published.

 

3. Check the correctness

When you have it done, your object is hosted on your network. Then you can access the remote object at the url:

Http: // <servername>/<appname>/<URI. Soap>? WSDL

Where <servername> is the name of the computer that hosts the object, <appname> is the name of the application, which is the same as the name of the virtual directory's application name. and <Uri. soap> is the URI that you specify in the object's web. config file.

 

If IE browser can response WSDL, it shows you 've successfully deployed remote object in IIS.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.