WCF Service Manual Deployment on windows server 2008 R2

In this blog I’ll describe the manual deployment process for secure WCF service on windows server 2008 R2 hosted on IIS, I will cover some common issues as well that you may face during the deployment

First you have to prepare the server to host WCF service as follows:

Install .net framework 4.5 by downloading and installing it from Microsoft site: http://www.microsoft.com/en-us/download/details.aspx?id=30653

On deployment server add web server role from server manager

image

then Add the following role services to web server role

image

image

 

After adding the role services and web server role ,the IIS will be shown in web server node from server roles

image

Next we will prepare the IIS host for the service, first we create app pool and set the identity for it

image

 

image

Then we add application on default websites assuming you will deploy to IIS default websites group.

Now to secure the service channel we have to install certificate on IIS server, this could be accomplished by selecting the server node from IIS server then select server certificate

image

From you here you could install the certificate to server

image

Now after installing the certificate we configure site binding by adding HTTPS on server bindings and select installed SSL certificate that is created from trusted Certificate authority

image

Check and Install latest updates on server

image

 

The server is ready to host the WCF service ,now am assuming you are done with development and your service is ready and configured as secure service

We will publish the service using visual studio to local desk drive , this could be accomplished by Right click on web project on visual studio that host WCF service then publish to local desk

image

image

Now we will copy the generated service files to production server created IIS website , the generated files mainly consist of bin folder that holds the DLLs configuration file and svc service files

image

Now if you face error “unrecognized attribute target framework” once you navigate to service, this is mainly caused by selecting .net framework 2.0 from app pool ; Just change the .NET framework version from App pool

image

image

another common error you may face could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding

image

This is mainly caused by missing HTTPs configuration on IIS server, if you configure your service security with

<security mode="Transport">

</security>

Or

<security mode=" TransportWithMessageCredential">

</security>

You have to configure HTTPs on IIS

image

other common issue you may face is Having internal server name in URL and WSDL URL which cause clients not being able to add service reference

image

image

To fix this add <useRequestHeadersForMetadataAddress/> to behavior section in WCF configuration

Remove address="" in from endpoint configuration

Add host header in IIS with service URL

Leave a Reply