Posts

Showing posts with the label WCF

3-6 yr Experience Interview Questions in .Net Technologies

3-6 yr Experience Interview Questions in .Net Technologies Hai Friends, Below I am posting the questions and answers for the short questions for 3-6 years experience guys. These questions will be helpful for those who are either preparing for the interview or attending the interviews. This will also be helpful for the last minute preparation in quickest way. If anyone has better answers, please reply to this post and I will include the better answer to the post as it will be helpful for all of us. CLR and C# 1. Types of Authentication IIS. A. Authentication is the process which helps web server(IIS) to check and confirm the identity of the client who request to access the website. Types of Authentication: a. Http Authentication: Basic Authentication, Digest Authentication b. Integrated Windows Authentication: NTLM(Network Lan Manager), Kerberos c. Client Certificates Access d. Anonymous and UnAuthenticated Access e. Logon-Redirection based: Form Authentication(IIS 7.0) ...

What is netNamedPipeBinding in WCF ?

NetNamedPipeBinding is the best mechanism for interprocess communication. With netNamedPipeBinding the security can be achieved only through transport level security as it does not support message level security. However messages are secured as only the same machine can call the service operations. The reason netNamedPipeBinding is the best mechanism because it gives you the default security . NetTcpBinding best when clients are only from intranet. ======= in web.config of service ====== <services> <service name="NorthwindServices.CustomerService" behaviorConfiguration="ServiceBehavior"> <host> <baseAddresses> <add baseAddress="net.pipe://localhost/NorthwindServices/" /> </baseAddresses> </host> <endpoint address="CustomerService" binding="netNamedPipeBinding" contract="NorthwindServices.ICustomer" /> <endpoint address="CustomerService/mex" binding="...

WCF Windows Service Hosting

Image
We are going to see the hosting WCF service in Windows service. We will use same set of code used for hosting the WCF service in Console application to this. This is same as hosting the service in IIS without message activated. There is some advantage of hosting service in Windows service. The service will be hosted, when system starts Process life time of the service can be controlled by Service Control Manager for windows service All versions of Windows will support hosting WCF service. Step 1:  Now let start create the WCF service, Open the Visual Studio 2008 and click New->Project and select Class Library from the template. Step 2:  Add reference  System.ServiceModel  to the project. This is the core assembly used for creating the WCF service. Step 3:  Next we can create the  ISimpleCalulator  interface as shown below. Add the Service and Operation Contract attribute as shown below. ISimpleCalculator.cs using System; using ...

WCF Windows Activation Service Hosting

Image
Windows Activation service is a system service available with Windows vista and windows server 2008. It is available with IIS 7.0 and it is more powerful compared to IIS 6.0 because it supports Http, TCP and named pipes were IIS 6.0 supports only Http. It can be installed and configured separately. Hosting WCF in Activation service takes many advantages such as process recycling, isolation, idle time management and common configuration system. WAS hosted service can be created using following steps Enable WCF for non-http protocols Create WAS hosted service Enable different binding to the hosted service Enable WCF for non-http protocols Before Start creating the service we need to configure the system to support WAS. Following are the step to configure WAS. Click Start -> Control Panel -> programs and Features and click 'Turn Windows Components On or Off' in left pane. Expand 'Microsoft .Net Framework 3.0' and enable "Windows Communication F...

WCF Self Hosting

Image
n web service, we can host the service only in IIS, but WCF provides the user to host the service in any application (e.g. console application, Windows form etc.). Very interestingly developer is responsible for providing and managing the life cycle of the host process. Service can also be in-pro i.e. client and service in the same process. Now let's us create the WCF service which is hosted in Console application. We will also look in to creating proxy using  'ClientBase'  abstract class. Note:  Host process must be running before the client calls the service, which typically means you have to prelaunch it. Step 1:  First let's start create the Service contract and it implementation. Create a console application and name it as MyCalculatorService. This is simple service which return addition of two numbers. Step 2:  Add the System.ServiceModel reference to the project. Step 3:  Create an ISimpleCalculator interface, Add ServiceContract and O...

WCF IIS 5/6 Hosting

Image
The main advantage of hosting service in IIS is that, it will automatically launch the host process when it gets the first client request. It uses the features of IIS such as process recycling, idle shutdown, process health monitoring and message based activation. The main disadvantage of using IIS is that, it will support only HTTP protocol. Let as do some hands on, to create service and host in IIS Step 1: Start the Visual Studio 2008 and click File->New->Web Site. Select the 'WCF Service' and Location as http. This will directly host the service in IIS and click OK. Step 2:  I have created sample HelloWorld service, which will accept name as input and return with 'Hello' and name. Interface and implementation of the Service is shown below. IMyService.cs [ServiceContract] public interface IMyService { [OperationContract] string HelloWorld(string name); } MyService.cs public class MyService : IMyService { #region IMyService Member...