In. NET 3.5, we need to do this:
1. Add a helloservice.svc file, add the ServiceHost tag, and add the name of the WCF service implementation to the service, for example:
<%@ ServiceHost language= "C #" debug= "false" service= "CNBlogs.Service.Impl.HelloService"%>
2. Add a binding to the web.config/system.servicemodel/bindings/basichttpbinding.
3. Add a behavior to the web.config/system.servicemodel/behaviors/servicebehaviors.
4. Add a service to the web.config/system.servicemodel/services and:
A to set the Behaviorconfiguration property.
b to set the Name property.
5. Add a endpoint under service and:
A to set the binding property.
b to set the Name property.
c) Set the Contract property.
In. NET 4, we just do this:
Add the following two properties to the Web.config/system.servicemodel/servicehostingenvironment/serviceactivations:
<add relativeaddress= "Helloservice.svc" service= "CNBlogs.Service.Impl.HelloService"/>
Once configured, the WCF service can be invoked normally.
If you need to generate a client proxy through SvcUtil.exe, simply add it in servicebehaviors:
<behavior>
<servicemetadata httpgetenabled= "true"/>
</behavior>
Recommended reading: A Developer ' s Introduction to Windows communication Foundation 4