WCF

1. What is WCF and need of WCF?
2. Message Layer Security

What:

WCF stands for Windows Communication Foundation. Which enables applications in a distributed environment to communicate with each other. t enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing.



Why:


what's the need for it? Well yeah it's the most probable query after a little initial understanding. Prior to WCF, there were a handful of technologies doing tasks of communication between a client and a server, they had their pros and cons. 

For instance:
• .ASMX Web Services allowed stuffs to be accessed from any platform.
• MSMQ allowed queuing of messages, so that communication between a client and server is possible even when the server was disconnected.
• .NET Remoting service allowed transfer of data between a client and server on Windows OS.

So if a developer had to develop an architecture having all the above functionalities, he had to learn the above technologies, which was a cumbersome task. Hence WCF was introduced by Microsoft to overcome these shortcomings. Basically WCF unified the above technologies into a single programming model for the ease of developing service oriented architecture



WCF Security



Useful Link:
  1. https://msdn.microsoft.com/library/ff406125.aspx
  2. https://msdn.microsoft.com/library/ff648863.aspx

When client applications and WCF services communicate, they do so by passing XML messages. Securing these messages is an important part of building, hosting and calling WCF services

When working with WCF or Web services, securing communication between the client and the service is very important. Transfer security is concerned with guaranteeing the integrity and confidentiality of WCF service messages as they flow from application to application across the network.

In WCF, transfer security is also responsible for providing authentication.

Transaction Layer  Security
   When using transport security, the user credentials and claims are passed by using the transport layer. In other words, user credentials are transport-dependent, which allows fewer authentication options compared to message security. Each transport protocol (TCP, IPC, MSMQ, or HTTP) has its own mechanism for passing credentials and handling message protection. The most common approach for this is to use Secure Sockets Layer (SSL) for encrypting and signing the contents of the packets sent over Secure HTTP (HTTPS).

Transport security is used to provide point-to-point security between the two endpoints (service and client). If there are intermediary systems between client and the service, each intermediate point must forward the message over a new SSL connection.


* Transport layer security basically encrypt the url and put into the certificate.
   when client request the url the that certificate get downloaded at client machine and store into registry file.

* If Any client  which don't have the same configuration i.e system has different hardware configuration and registry is not there then transport layer security will not work there.

Note: Transport security is available on all of the bindings except for wsDualHttpBinding.


Steps To enable Transport layer security in WCF

1. Install the certificate by using IIS (create self signed certificate)
2. Enable basic authentication for Internet Information Services.
3. deploy the service on IIS and make binding as HTTPS and the it will ask for certificate
    assign the created certificate
   when you assign the certificate then you see th eport number will get changed
   so now you need to change th eport number for the certificate then only application will run
  >> now how you changed the certificate port number 

   Open Visual studio cmd as run as administrator
   use the command to get all the certificate
   >> netsh https show sslcert
  Now how to change port
  >> netsh https add sslcert nethash=<hashcode of certificate> appid=<new guid>

  a. to get hashcode of certificate go to certificate and view the detial for that and choose thumnail and copy the code
     remove the space and copy that at the place of <hashcode of certificate>
b. <new guid> : go to visual studio >Tool>create guid>register **** copy that code and pase in above command.

4. add below code into your webcinfig file
  <bindings>
    <basicHttpBinding>
      <binding name="basicHttpBindingConfig">
        <security mode="Transport">
          <transport clientCredentialType="none" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>

5. test you service.

No comments:

Post a Comment

Contact Us:

Email:

Vinodkumar434@gmail.com,
vinodtechnosoft@gmail.com

Skype Name:

vinodtechnosoft