News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Advertisement

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;
[ServiceContract]
public interface ITestService
{
[OperationContract]
DateTime GetServiceTime();
}

TestService is hosted in an ASP.NET application. You need to modify the application to allow the GetServiceTime method to return the data formatted as JSON. It must do this only when the request URL ends in /ServiceTime. What should you do?

  1. Add this attribute to the GetServiceTime method.

    [Weblnvoke(Method="POST")]

    In the web.config file, add this element to system.serviceModel/behaviors/endpointBehaviors.

    <behavior name="Json">
    <enableWebScript />
    </behavior>

    In the web.config file, configure TestService in the system.serviceModel/services collection as follows:

    <service name="TestService">
    <endpoint address="/ServiceTime"
    contract="TestService"
    behaviorConfiguration="Json"
    binding="webHttpBinding" />
    </service>
  2. Add this attribute to the GetServiceTime method.

    [Weblnvoke(Method="GET',  UriTemplate="/ServiceTime",ResponseFormat=WebMessageFormat.Json)]

    In the web.config file, configure TestService in the system.serviceModel/services collection as follows:

    <service name="TestService">
    <endpoint address="/ServiceTime"
    contract="TestService"
    binding="webHttpBinding"/>
    </service>
  3. Add this attribute to the GetServiceTime method

    [WebGet(ResponseFormat=WebMessageFormat.Json, UriTemplatee"/ServiceTime")]

    Create a new svc file named Jsonversion.svc with the following content.

    <%ServiceHost Service="TestService" Factory="System.ServiceModel.ActivationWebServiceHostFactory" %>
  4. Add this attribute to the GetServiceTime method.

    [WebGet(UriTemplate="Json)/ServiceTime")]

    Create a new .svc file named Jsonversion.svc with the following content

    <%ServiceHost Service="TestService" Factory="System.ServiceModel.ActivationWebServiceHostFactory" %>
Answer: Answer is c
comments powered by Disqus
Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;