WCF Tutorial | What's new in WCF 4.5 Part 2
What's new in WCF 4.5 - Part 2
Simplified Generated Configuration Files
In old version WCF, configuration files generated at the client side will have all default setting and it looks complex. But in WCF 4.5, when you generate the configuration file using SvcUtil.exe tool or Service Reference only non-default value will be available in the configuration file.
Fig 1: Configuration file generated in WCF 4.0
Fig 2: Configuration file generated in WCF 4.5
In WCF4.5, Using "SvcUtil.exe" you can generate only the contract files, in old version this feature is not available. If you create the proxy using "SvcUtil.exe", system will generate the contract, service client operation and data contract in single "service.cs" file. If you want to generate only contract you can use this simple command
Fig 3:Contract file creation using SvcUtil.exe
- Always create the service with Interface->Implementation format, mention the contract in Interface.
- Define the service in Class library and refer the class library in Host project. Don’t use service class in host project.
- Change the instance mode to per call as default.
- Always catch exception using try/catch block and throw exception using FaultException < T >.
- Logging and Include exception should be enable while compiling the project in debug mode. While in production deployment disable the logging and Include exception details.