What's new in WCF 4.5 - Part 7
Support for UDP Endpoint
WCF 4.5 allows to use the UDP protocol for communication, so that developer can create the oneway operation message(fire and forget). In certain scenario UDP is much faster than TCP protocol, because TCP add extra validation to check message are delivered in order. But in case of UDP data deliver is not guaranteed
Configuration settings
<service name="TestService" behaviorConfiguration="MyServiceBehaviour">
<endpoint address="" binding="udpBinding" bindingConfiguration ="MyBindingSetting"
contract="iservice">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
Multiple Authentication Support
When you develop an ASP.Net application, multiple authentication modes are enabled by changing the “Authentication” setting on virtual directory
Similarly WCF4.5 provides multiple authentications for single endpoint when using the HTTP transport and transport security. In old version WCF, multiple authentications for single service can be provided by creating different endpoint. But in case of WCF4.5 multiple authentications can be configured using single endpoint.
Steps to enable Multiple Authentication in WCF
Step 1: Create WCF service in host in IIS, Set the authentication as mention below
Step 2: Set the security mode to Transport or TransportCredentialOnly and clientCredentialType to "InheritedFromHost"
<security mode="TransportCredentialOnly">
<transport clientCredentialType="InheritedFromHost"/>
</security>
Tips!
- 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.
|