Saturday, April 26, 2014

Hosting WCF service on IIS

Check whether you have IIS installed on your machine or not. If you don't have check below link.

Create a WCF service in Visual studio as shown in the below screens

And create an endpoint as shown in below config settings.

      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />

                <behavior name="ServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"  />
                    <serviceDebug includeExceptionDetailInFaults="true" />
          <behavior name="EndpBehavior">
        <service behaviorConfiguration="ServiceBehavior" name="WCF_Tutorials.Service1">
          <endpoint address="" binding="webHttpBinding" contract="WCF_Tutorials.IService1" behaviorConfiguration="EndpBehavior"></endpoint>
        <endpoint address="mex"
                  contract="IMetadataExchange" />
        <!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
            multipleSiteBindingsEnabled="true" />-->

Once you are done with the creation of WCF service, you can host the service in IIS as shown in the below images.

Run-> inetmgr

Provide Alias Name and Physical Path information in the popup screen

Then create new virtual directory under newly created application

Provide Alias name and physical path information

It done with your hosting on IIS. Test your service as follows

Installing IIS on windows 7

1. Windows->Control Panel

2. Clink on Program

3. Click on Turn windows features on or off


4. Set the below settings for IIS


Thats it.

To launch IIS, Run->inetmgr