BasicHttpBinding

BasicHttpBinding is suitable for communicating with ASP.NET Web Service (ASMX) based services that conform to the WS-Basic Profile that conforms with Web Services.

WCF BasicHttpBinding

Let's get started. Use the following procedure.
Now we need to name this project; I am naming it WCF_TUTO_Pxpress1 (I am creating a basic pizza service kind of view and that is why I named it Pxpress1.)
wcf service application
After adding the project just look for this view in your solution.
Adding project
From that you will see the default service has been created. We are going to just delete this service and add a new service to this project after deleting the service.
deleting service
Now to add a new service right-click on the project then select Add New Item and from that select WCF Service.
wcf service
After adding the new service the solution view will look like this.
Iservice
The preceding is from after adding the WCF service.
I will first move to the IService interface and delete all the methods and add a new method with the name OrderPizza_by_Mobileno.
add new method
After adding the method I will now move to the Service1.svc. In Service1.svc I will implement IService1.cs.
implement IService
After implementing the interface I will now just move towards the Web.config for configuring the address, binding, contract and endpoint.
Web config
The following describes how to add this tag (step-by-step with snapshots) to the web.config.
  1. System.serviceModel

    System service Model

  2. Services

    Services

  3. Service (name of service and the behaviour the configuration)

    behaviour Configuration

  4. Endpoints (address, binding and contract) , second endpoint to expose metadata

    expose metadata

  5. Behaviours

    Behaviours
After configuring Webconfig.cs now let's build your application and run it.
After running in the browser you will find the files in your browser. Just click on the Service1.svc file.
see directory listing
After clicking on that link you will see a Service1.svc link and you can consume this link anywere you want, whether in a console, web or Java application or cross-platform also.
create service
cross platform
For testing your service you must open a Visual Studio Command Prompt and inside that you will write wcftestclient and press Enter.
Command Prompt
A new dialog will pop up from that.
My service properties
After this just click on File in the menu and select Add Service.
recent service
A small dialog will pop up for entering an endpoint address.
Just copy and paste the address that we got while running the application from the browser.
Endpoint address : http://localhost:2226/Service1.svc.
test service
add service
Click the OK button now.
You will see your Service name that you have exposed and just double-click on that method. You will see which parameters must be passed to that service.
pass to that service
Just enter all the parameters and click the button Invoke. After clicking the button Invoke you will get an answer returned.
Invoke
Finally, we have completed Tutorial 1 of WCF How to create WCF basichttpbinding.
In the next tutorial, you will see how to consume this service in a Windows and web application.
Thanks for reading this article.