java2db

How to create WCF web service in C# .NET ( visual studio 2013 )



Web Services are a set of programming interfaces , that can be accessible from different software applications or different platforms using XML based messages. It is very simple to create WCF web service in C# .NET in visual studio 2013.

How to create WCF web service in C# .NET Steps to create WCF web service in C# .NET :

How to create WCF web service in C# .NET Step 1 :

Create a C#  project in visual studio  2013 ( File -> New -> Project )

How to create WCF web service in C# .NET If you want , you can create a Web Site .

 

 

How to create WCF web service in C# .NET

 

 

 Step 2 :

Expand left side  Visual C#  menu and select WFC. Select WCF Service Application from the right side. Give any name for your project at bottom text box . In our example, the name is FirstWCFServiceExe .

How to create WCF web service in C# .NET

Click finish ,the new project will create in the Solution Explorer .

 

 

 Step 3 :

Add a New Item to the project (Right click on the project , select Add -> New Item).

How to create WCF web service in C# .NET
 Step 4 :

From the New Item popup window , select Web -> WCF Service . Give any name to the service in the text box (Example : FirstService.svc ).
How to create WCF web service in C# .NET

 

 

 

 Step 5 :

So  the New Item added to the project tree .

How to create WCF web service in C# .NET

 

 

 Step 6 :

Copy the below code to FirstService.svc.cs and IFirstService.cs  files .

 

FirstService.svc.cs

The above class having a simple method which returns a string.

IFirstService.cs

 

 

 

 Step 7 :

Build the project  (Ctrl+F7) .

 

 

 Step 8 :

If it build successfully , the below window will appear . Copy the below URL .
How to create WCF web service in C# .NET

 

 

 Step 9 :

Add ?wsdl at the end of the URL  http://localhost:49179/FirstService.svc .Now the full URL is http://localhost:49179/FirstService.svc?wsdl .
Paste the URL in the web browser . Finally , you will get the WSDL file.
How to create WCF web service in C# .NET

Now you can test the service with SoapUI by using the WSDL url . We explained here that how to test with SoapUIcreate WCF web service in C# .NET




Related Posts :
How to call C# .Net WCF web service in PHP SOAP client
How to call java SOAP web service in php ( php web service client )
What is RESTful web service (Introduction to RESTful web services)
How to call a web service from another web service (web service chain)
How to provide security to SOAP web services ( JAX-WS )
How to handle custom exceptions using SOAP faults in web services
How to Create a java web service using bottom up approach
Create a java web service from WSDL (Top down approach) in Eclipse
   [will not be published]



^ <