For more details, visit us at http://www.softwareandfinance.com/VSNET_40/Index.html
Here is the step by step instructions for hosting WCF service in IIS.
WCF Hosting in IIS - Step By Step Instructions
1. Create a "WCF Service Application" under VS2010
2. Do a refactor to change the service name and implement desired methods.
3. The files needed to host WCF service on IIS are given below:
4. The configuration of web.config file is discussed in the next section.
5. Create a virtual directory under IIS and make it as an application root. otherwise you would not be able to use the web config defined under this virtual directory.
6. Copy the 3 files given on the step 3 into the virtual directory.
7. Then you can access the .SVC wcf service using any IE.
8. You can click the following link to invoke the WCF service which is given in my sample. http://www.softwareandfinance.com/wcftestservice/TestService.svc
web.config file configuration
1. Under services, you can have a collection of services.
2. For each service, you can have the service name and multiple endpoints.
3. For end point configuration: you need Address, Binding and Contract. You can remember with ABC for address, binding and contract
4. The contract IMetadataExchange with address mex and binding type mexHttpBinding contains the meta data information and is used to expose the list of other services.
5. If you want to disable meta data, then add the service behaviorconfiguration with <serviceMetadata httpGetEnabled="false"/>
6. multipleSiteBindingsEnabled should be set to true under serviceHostingEnvironment to enable multiple bindings in each end points.
7. The ServiceActivations settings will have the relative address of the .SVC file from the virtual directory application root and the service name.
8. The following is the sample web.config file used to host WCF service in http://www.softwareandfinance.com/wcftestservice/TestService.svc
<compilation debug="true" targetFramework="4.0" />
<service name="Wcf_Test_Service.TestService" behaviorConfiguration="MyServiceTypeBehaviors">
<add relativeAddress="TestService.svc" service="Wcf_Test_Service.TestService"/>
</configuration> For more details, visit us at http://www.softwareandfinance.com/VSNET_40/Index.html