Default properties of WCF service
Recently I tried to create a WCF service manually without using WCF service project template in Visual Studio 2010. I found a strange nature in the service which was different from my usual understanding.
I followed the following steps.
1. Created a web project.
2. Added two class files, one for Service Contract Interface and another for the service definition.
3. Created a service file (.svc) with the definitions pointing to the contract and namespace I have created.
The only thing I left alone was the configuration. I didn’t add any end point to expose my service out.
To my understanding, from the recommendation of any book or article I read, a service must expose an end point either through configuration or through the code.
I wanted to see the behavior of the service without specifying an endpoint explicitly to it.
I ran the service and found that it’s hosted usually as any web application hosted from file system.
On selecting the .svc link, I could get the WSDL link.
I then created a client application to consume the service and to see if its also behaving properly. I added a service reference and gave the address of the WSDL.
It worked flawlessly.
From this exercise I figured out the following.
1. An endpoint is not a mandatory thing for a WCF service.
2. When we create a consumer that adds service reference, the consumer project/application adds an endpoint in the configuration.
3. The end point in the consumer points to an address such as http://localhost:12345/TaskManagerService.svc.
4. The consumer calls the service through basicHTTPBinding. Hence basicHTTPBinding looks to be the default binding that Visual studio arrange for the developers.
5. The address of the WSDL port number and the address stays constant how many ever times we restart the applications. This behavior is due to the Developer Server arrangement by the Visual Studio.