Home > WCF > WCF # – 7 Create and host a WCF website in IIS

WCF # – 7 Create and host a WCF website in IIS

Hi Geeks,

In this article,we will cover following things

  • Create a WCF Website
  • Host a WCF website in IIS [Internet Information Services]
  • Test the hosted site [To check whether it is correctly hosted or not]

NOTE :

To host the WCF website in IIS.Before , you must have created a WCFApplication/WCF Library containing your services.

1) Create a WCF Website

Step I : Take a new WCF Web Site

image

Click on the Website tab and you will see following window opened

image

Step II :

After creation of a WCF website go to the Solution explorer and add the Bin folder to it as shown in the figure below

image

Step III :

Right click on the bin folder created in above step and add the reference of the WCFApplication / WCFLibrary that you have already created.

image

Click on add reference you will see following window opened

image

Now your WCF website has been created and now we have to host it somewhere for using this website,so will host this site in to our IIS (Internet Information Services).

 

2) Host a WCF website

There are three steps in hosting a service in IIS:
Step I :

Create an ApplicationPool  in IIS to store the service.

Go to an IIS

image

Right click on Application pool and add the new Application pool

image

 

Step II :

Create a WebSite in IIS to host the WCF service

image

The Physical path in the following figure is the path of the WCF Website folder that we have created above .

image

Hosting of the WCF Website has been completed here.

3) Test the Hosted Service

To Test whether site has been hosted correctly or not follow the following steps.

Step I :

Open the IIS.

Select the hosted website from the default web sites folder go to the right and say

Browse

image

then  u will see the following WebPage opened with address as http://localhost/HostWCFService

image

Step II :

Now append the name of the .svc file in your WCF website to the address in the above address like follow

http://localhost/HostWCFService/Service.svc  You will see the WebPage opened like follow.

image

After seeing this window with the main() method inside it,you can definitely say  you have hosted the WCF Website correctly.

 

Thank you.

Advertisements
Categories: WCF
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: