Create Project for WebService

In Visual Studio 2015, select New Project, and select the ASP.NET Web Application template.


I name the project AuthenticatorService (which describes what it is supposed to do)

For template, I select the Empty template, as I like to code myself and don’t need the other stuff.


In the Project, I now add the actual Webservice, by selecting Project | Add New Item and choosing the WCF service Template, which I name AuthenticatorService.svc (like the overall project)


I refactor the generated code, so I have the interface IIdentityChecker and the corresponding class IdentityChecker.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace AuthenticatorService

public interface IIdentityChecker

void DoWork();



When you run this, you have your empty service ready on your local machine.

on my PC, this is: http://localhost:43787/authenticatorservice.svc (on yours it will probably use another port 🙂

This is the output:


IdentityChecker Service


IdentityChecker Service


You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:


svcutil.exe http://localhost:43787/AuthenticatorService.svc?wsdl

You can also access the service description as a single file:


This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:


class Test
    static void Main()
        IdentityCheckerClient client = new IdentityCheckerClient();

// Use the ‘client’ variable to call operations on the service.

// Always close the client.


Visual Basic

Class Test
    Shared Sub Main()
        Dim client As IdentityCheckerClient = New IdentityCheckerClient()
        ' Use the 'client' variable to call operations on the service.

‘ Always close the client.
End Sub
End Class






Post a comment

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

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


Connecting to %s