WCF: deploy WCF service on IIS7

You can run REST-ful  WCF services over http from IIS7. I have configured it on Windows 7.  It is needed to configure IIS7 to run WCF service over http bindings.

  1. Install IIS7
  2. Configure .Net features for WCF  [as shown below]
    1. Control Panel -> Programs ->Turn Windows features on or off
    2. Check WCF Http Activation and WCF non-Http Activation
    3. Check Web Management Tools
    4. WindowsFeaturesOnOff
      WindowsFeaturesOnOff
  3. Add HttpHandler for *.svc in IIS
    1. Control Panel->System and Security->Administrative Tools
    2. Click on Internet Information Services (IIS) Manager
    3. Click on Sites-> Default Web Site(you may add your own site)
    4. On the right panel find “Handler Mappings”
    5. Add *.svc handler – at most right panel click on “Add Managed Handler”
  4. Add MIME type for *.svc in IIS
    1. Click on Default Web Site
    2. Find at right panel “MIME Type”  and click on it
    3. Click on Add at most right panel
    4. put mime type for Wcf service .svc file
    5. MimeType for .svc
      MimeType for .svc
  5. Open your WCF project as administrator user
    1. Right click on VS2008 icon
    2. From context menu select
    3. VisualStudio as admin
      VisualStudio as admin
  6. Update  web.config file for http bindings so that WCF services response over http request
    1. modify web server validation mode as false
    2. add service model behavior in system.servicmodel section
<system.webServer>
 <validation validateIntegratedModeConfiguration="false"/>
 <!--        remove modules and handlers from this section   -->
</system.webServer>

<system.serviceModel>
 <services>
 <service name="WcfServiceZamanService.TrackingService" behaviorConfiguration="WcfServiceZamanService.Service1Behavior">
 <endpoint address="" binding="webHttpBinding" contract="WcfServiceZamanService.ITrackingService" behaviorConfiguration="web">
 <identity>
 <dns value="localhost"/>
 </identity>
 </endpoint>
 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
 </services>
 <behaviors>
 <serviceBehaviors>
 <behavior name="WcfServiceZamanService.Service1Behavior">
 <serviceMetadata httpGetEnabled="true"/>
 <serviceDebug includeExceptionDetailInFaults="false"/>
 </behavior>
 </serviceBehaviors>
 <endpointBehaviors>
 <behavior name="web">
 <webHttp/>
 </behavior>
 </endpointBehaviors>
 </behaviors>
</system.serviceModel>


7. Publish WCF service to file/site

  1. Right click on WCF project
  2. Find and click on Publish option
  3. Publish to default web site [select where you want to publish it]
  4. publish_wcf_service
    publish_wcf_service

That’s all, have a nice journey to WCF

Advertisements

About M Moniruzzaman
A passionate software engineer, have been developing applications on various platforms such as Android, iPhone, .Net (C#) technologies and web based ASP.NET, PHP, JavaScript, jQuery technologies for more than 10 years. Especially I have expertise on developing applications for Android and iPhone, as well as service oriented, client-server based applications where clients will be reside on Android/iPhone that communicate with WCF(.NET) service hosted on server. I have completed certification in Microsoft Certified Professional Developer (MCPD) on .Net 4 . I have completed my graduation in -- B.Sc. (Engineering) in Computer Science and Engineering, ShahJalal University of Science and Technology, Bangladesh. Thanks, M. Moniruzzaman (Zaman)

2 Responses to WCF: deploy WCF service on IIS7

  1. technomaxs says:

    I could not get working after folllowing the steps given by you. Could you please help me on it.

  2. oyaebunterkrah says:

    if I had not seen this screenshot (https://zaman91.files.wordpress.com/2010/10/windowsfeatures.jpg?w=300&h=300), I would still be f@cking my brain a few days

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

%d bloggers like this: