Microsoft TS: Windows Communication Foundation velopment with Microsoft .NET Framework 4 - 70-513 Exam Practice Test
You are creating an ASP.NET Web application that hosts several Windows Communication
Foundation (WCF) services. The services have ASP.NET Compatibility Mode enabled. Users authenticate with the Web application by using a cookie-based ASP.NET Forms Authentication model.
You add a service file named Authentication.svc that contains the following code segment.
<%@ ServiceHost
Service="System.Web.ApplicationServices.AuthenticationService"
Factory="System.Web.ApplicationServices.ApplicationServicesHostFactory" %>
You need to ensure that users can access the WCF services without having to re-authenticate.
Which two configuration settings should you add (Each is part of a complete solution. Choose two.)
Foundation (WCF) services. The services have ASP.NET Compatibility Mode enabled. Users authenticate with the Web application by using a cookie-based ASP.NET Forms Authentication model.
You add a service file named Authentication.svc that contains the following code segment.
<%@ ServiceHost
Service="System.Web.ApplicationServices.AuthenticationService"
Factory="System.Web.ApplicationServices.ApplicationServicesHostFactory" %>
You need to ensure that users can access the WCF services without having to re-authenticate.
Which two configuration settings should you add (Each is part of a complete solution. Choose two.)
Correct Answer: A,D
Vote an answer
A Windows Communication Foundation (WCF) service only accepts messages that are signed and encrypted a client application is not receiving expected responses from the service.
You need to enable logging to verity that the messages from the client are signed and encrypted.
You also need to see what each message looks like before the message body is deserialized into a
NET object what should you do?
You need to enable logging to verity that the messages from the client are signed and encrypted.
You also need to see what each message looks like before the message body is deserialized into a
NET object what should you do?
Correct Answer: B
Vote an answer
The endpoint of a Windows Communication Foundation (WCF) service uses basicHttpBinding for its binding. Your company's policies have changed to require that messages not be sent in clear text.
You must ensure that all messages are encrypted when traveling across the network.
What should you do?
You must ensure that all messages are encrypted when traveling across the network.
What should you do?
Correct Answer: B
Vote an answer
A Windows Communication Foundation (WCF) service is generating a separate namespace declaration for each body member of a message contract, even though all body members share the same namespace.
You need to simplify the XML representation of your message contract so that the namespace is only declared once.
What should you do?
You need to simplify the XML representation of your message contract so that the namespace is only declared once.
What should you do?
Correct Answer: A
Vote an answer
You are creating a Windows Communication Foundation (WCF) service.
You need to ensure that the service is compatible with ASP.NET to make use of the session state.
Which binding should you use?
You need to ensure that the service is compatible with ASP.NET to make use of the session state.
Which binding should you use?
Correct Answer: B
Vote an answer
A Windows Communication Foundation (WCF) solution uses the following contract to share a message across its clients. (Line numbers are included for reference only.)
01 <ServiceContract()> 02 Public Interface ITeamMessageService 03 04 <OperationContract()> 05 Function GetMessage() As String 06 07 <OperationContract()> 08 Sub PutMessage(ByVal message As String) 09 End Interface The code for the service class is as follows.
10 Public Class TeamMessageService 11 Implements ITeamMessageService 12 13 Dim key As Guid = Guid.NewGuid() 14 Dim message As String = "Today s Message" 15 16 Public Function GetMessage() As String _ 17 Implements ITeamMessageService.GetMessage 18 19 Return String.Format("Message:{0}. Key:{1}", message, key) 20 End Function 21 22 Public Sub PutMessage(ByVal message As String) _ 23 Implements ITeamMessageService.PutMessage 24 25 Me.message = message 26 End Sub 27 28 End Class
The service is self-hosted. The hosting code is as follows.
29 Dim host As ServiceHost = New ServiceHost(GetType(TeamMessageService)) 30 Dim binding As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode.None)
31 host.AddServiceEndpoint(
"MyApplication.ITeamMessageService", binding,
"http://localhost:12345")
32 host.Open()
You need to ensure that all clients calling GetMessage will retrieve the updated string if the message is updated by any client calling PutMessage.
What should you do?
01 <ServiceContract()> 02 Public Interface ITeamMessageService 03 04 <OperationContract()> 05 Function GetMessage() As String 06 07 <OperationContract()> 08 Sub PutMessage(ByVal message As String) 09 End Interface The code for the service class is as follows.
10 Public Class TeamMessageService 11 Implements ITeamMessageService 12 13 Dim key As Guid = Guid.NewGuid() 14 Dim message As String = "Today s Message" 15 16 Public Function GetMessage() As String _ 17 Implements ITeamMessageService.GetMessage 18 19 Return String.Format("Message:{0}. Key:{1}", message, key) 20 End Function 21 22 Public Sub PutMessage(ByVal message As String) _ 23 Implements ITeamMessageService.PutMessage 24 25 Me.message = message 26 End Sub 27 28 End Class
The service is self-hosted. The hosting code is as follows.
29 Dim host As ServiceHost = New ServiceHost(GetType(TeamMessageService)) 30 Dim binding As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode.None)
31 host.AddServiceEndpoint(
"MyApplication.ITeamMessageService", binding,
"http://localhost:12345")
32 host.Open()
You need to ensure that all clients calling GetMessage will retrieve the updated string if the message is updated by any client calling PutMessage.
What should you do?
Correct Answer: D
Vote an answer
You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows.
[DataContract(Namespace = "")]
public class Item
{
...
}
[ServiceContract(Namespace = "")]
public interface ICatalog
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/Item")]
Item UpdateItem(Item item);
}
The client application receives a WebResponse named response with the response from the service.
You need to deserialize this response into a strongly typed object representing the return value of the method.
Which code segment should you use?
[DataContract(Namespace = "")]
public class Item
{
...
}
[ServiceContract(Namespace = "")]
public interface ICatalog
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/Item")]
Item UpdateItem(Item item);
}
The client application receives a WebResponse named response with the response from the service.
You need to deserialize this response into a strongly typed object representing the return value of the method.
Which code segment should you use?
Correct Answer: C
Vote an answer
A Windows Communication Foundation (WCF) client configuration file contains the following XML segment in the system.serviceModel element.
<client>
<endpoint address=" net.tcp://server/ContosoService "
binding=" netTcpBinding "
contract=" Contoso. IContosoService "
name=" netTcp " / >
<endpoint address=" net.pipe://localhost/ContosoService "
binding=" netNamedPipeBinding "
contract=" Contoso. IContosoService "
name=" netPipe " />
</client>
You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService.
Which code segment should you use
<client>
<endpoint address=" net.tcp://server/ContosoService "
binding=" netTcpBinding "
contract=" Contoso. IContosoService "
name=" netTcp " / >
<endpoint address=" net.pipe://localhost/ContosoService "
binding=" netNamedPipeBinding "
contract=" Contoso. IContosoService "
name=" netPipe " />
</client>
You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService.
Which code segment should you use
Correct Answer: B
Vote an answer