What's new in WCF 4.5 - Part 3
Default - ASP.NET Compatibility Mode
In general WCF service hosting AppDomain can run in two different mode
- Mixed Transports Mode(Default): In this mode does not participate in ASP.NET HTTP pipeline and it behaves consistently independent of hosting environment and transport.
- ASP.Net Compatibility Mode: In this mode, service will participate in ASP.Net HTTP pipeline and it is similar to old web service (.asmx). ASP.NET features such as File Authorization, UrlAuthorization, and HTTP Session State are applicable to services running in this mode
In WCF 4.5 default aspNetCompatibilityEnabled attribute to true in web.config
Fig 1: WCF 4.5 Configuration file
Fig 2: WCF 4.0 Configuration file
In WCF 4.5, tooltips are provided for configuration file, this makes the developers job simple.
XmlDictionaryReaderQuotas contains configurable quota values for XML dictionary readers which limit the amount of memory utilized by an encoder while creating a message. While these quotas are configurable, the default values have changed to lessen the possibility that a developer will need to set them explicitly
||128 nodes deep
- 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.