WCF Interview Questions and Answers Part 5

1. How to make wcf to return json response?

Ans. We can use WebInvoke and WebGet attributes over operations contracts by specifying WebMessageFormat.Json in "ResponseFormat=".

public interface IStudent
   [WebGet(UriTemplate = "Student", ResponseFormat=WebMessageFormat.Json )]
   List < Employee > GetAllStudentss();

2. What are the communication message formats in wcf?
Ans. Xml and json

3. What are the impersonation settings levels in wcf?
Ans. There are 3 levels of impersonation settins available,
1. NotAllowed 2. Allowed and 3. Required

4. How many types of bindings supported for metadata exchange in wcf?
Ans. There are four bindings supported for metadata exchange in wcf,
1. mexHttpBinding,
2. mexHttpsBinding,
3. mexNamedPipesBinding and 4.mexTcpBinding.

5. How to define sessionful service in wcf?

Ans. Sessionful service is created with the help of sessionmode attribute.
    [ServiceContract(SessionMode = SessionMode.Required)]
    interface IMyService
        [OperationContract(IsOneWay = true)]
        void TestMethod();


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker