Pages

Ads 468x60px

Thursday, August 18, 2011

MCP 70-503 dumps download-Latest dumps


70-503





Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application
  Developer    
Exam Type: Microsoft      
Exam Code: 70-503)   Total Questions: 150
    Microsoft 70-503(C#)  

Question: 1

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service uses the net.tcp transport. You need to ensure that when the server starts, the service starts and continues to run. What should you do?

A.Host the service in a Windows service.

B.Host the service in a Windows Presentation Foundation application.

C.Host the service under IIS 7.0 by using IIS 6.0 compatibility mode.

D.Host the service under IIS 7.0 by using Windows Activation Services.

Answer: A

Question: 2

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a managed Console application. You want to add endpoints to the service. You need to ensure that all endpoints use the same base address. Which code fragment should you use?

A.[ServiceContract]public interface IMortgageService {}public class MortgageService : IMortgageService {}Uri baseAddress=new Uri("http: //localhost:8888/MortgageService");ServiceHost serviceHost= new ServiceHost(typeof(MortgageService), new Uri[] {baseAddress });serviceHost.AddServiceEndpoint(typeof(IMortgageService), new BasicHttpBinding(), "");serviceHost.Open();

B.[ServiceContract]public interface IMortgageService {}public class MortgageService : IMortgageService {}Uri baseAddress=new Uri("http: //localhost:8888/MortgageService");ServiceHost serviceHost= new ServiceHost(typeof(MortgageService), new Uri[] {});serviceHost.AddServiceEndpoint(typeof(IMortgageService), new BasicHttpBinding(), baseAddress);serviceHost.Open();

C.[ServiceContract]public interface IMortgageService {}public class MortgageService : IMortgageService {}string baseAddress="http: //localhost:8888/MortgageService";ServiceHost serviceHost= new ServiceHost(typeof(MortgageService), new Uri[] { });serviceHost.AddServiceEndpoint(typeof(IMortgageService), new BasicHttpBinding(), baseAddress);serviceHost.Open();

D.[ServiceContract(Namespace="http: //localhost:8888/MortgageService")]public interface IMortgageService {}public class MortgageService : IMortgageService {}ServiceHost serviceHost= new ServiceHost(typeof(MortgageService), new Uri[] { });serviceHost.AddServiceEndpoint(typeof(IMortgageService), new BasicHttpBinding(), "");serviceHost.Open();

Answer: A

Question: 3

Page 1 of 77



Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You need to host the WCF service on the IIS Web server. First, you create a new folder for your application files. Next, you use the IIS management tool to create a Web application in the new folder. Which three actions should you perform next? (Each correct answer presents part of the solution. Choose three.)

A.Create a web.config file that contains the appropriate configuration code. Place this file in the application folder.

B.Create a web.config file that contains the appropriate configuration code. Place this file in the same folder as your service contract code.

C.Create a service file that has the .svc extension containing the @service directive information for the service. Move this file to the application folder.

D.Create a service file that has the .svc extension containing the @servicehost directive information for the service. Move this file to the application folder.

E.Create a vti_bin sub-folder within the application folder for your code files. Place the code file that defines and implements the service contract in this folder.

F.Create an App_Code sub-folder within the application folder for your code files. Place the code file that defines and implements the service contract in this folder.

Answer: A, D, F

Question: 4

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted on a Web server.

You add the following code fragment to the .svc file.

<% @ServiceHost Factory="ExamServiceFactory" Service="ExamService" %>

You need to create the instances of the services by using the custom ExamServiceFactory class. Which code segment should you use?

A. public class ExamServiceFactory : ServiceHost{ protected override void ApplyConfiguration()
{  
//Implementation code comes here. }}  

B.public class ExamServiceFactory : ServiceHostBase{ protected override void ApplyConfiguration() {

//Implementation code comes here. }}

C.public class ExamServiceFactory : ServiceHostFactory{ protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { //Implementation code comes here.

}}

D.public class ExamServiceFactory : ServiceHost{ public ExamServiceFactory(Type serviceType, params

Uri[] baseAddresses) : base(serviceType, baseAddresses) { //Implementation code comes here.

}}

Answer: C

Question: 5

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You need to expose two different service endpoints that have the same address. Which configuration setting should you use?

A. <service name="ExamService"> <endpoint address="http:.//localhost:8080/service" binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint address="http: //localhost:8080/service" binding="wsHttpBinding" contract="IComplexExam"/></service>

Page 2 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.<service name="ExamService"> <endpoint address="http: //localhost:8080/service" binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint address="http: //localhost:8080/service" binding="wsDualHttpBinding" contract="IComplexExam"/></service>

C.<service name="ExamService"> <host> <baseAddresses> <add baseAddress="http: //localhost:8080/service"/> </baseAddresses> </host> <endpoint binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint binding="basicHttpBinding" contract="IComplexExam"/></service>

D.<service name="ExamService"> <host> <baseAddresses> <add baseAddress="http: //localhost:8080"/> </baseAddresses> </host> <endpoint address="service" binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint address="service" binding="basicHttpBinding" contract="IComplexExam"/></service>

Answer: A

Question: 6

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You need to host the service in a medium trust environment on a Web server. Which two bindings should you use? (Each correct answer presents a complete solution. Choose two.)

A.NetMsmqBinding

B.BasicHttpBinding

C.WSDualHttpBinding

D.NetTcpBinding

E.WebHttpBinding

Answer: B, E

Question: 7

You are creating a Windows Communication Foundation service by using

Microsoft .NET Framework 3.5. You need to programmatically add the following endpoint definition to

the service. http://localhost:8000/ExamService/service Which code segment should you use?

A.String baseAddress="http: //localhost:8000/ExamService";BasicHttpBinding binding1=new BasicHttpBinding();using(ServiceHost host=new ServiceHost(typeof(ExamService))){ host.AddServiceEndpoint(typeof(IExam),binding1,baseAddress);}

B.String baseAddress="http: //localhost:8000/ExamService/service";BasicHttpBinding binding1=new

BasicHttpBinding();using(ServiceHost host=new ServiceHost(typeof(ExamService))){ host.AddServiceEndpoint(typeof(IExam),binding1,baseAddress);}

C.String baseAddress="http: //localhost:8000/ExamService";WsHttpBinding binding1=new WsHttpBinding();using(ServiceHost host=new ServiceHost(typeof(ExamService))){ host.AddServiceEndpoint(typeof(IExam),binding1,baseAddress);}

D.String baseAddress="net.tcp: //localhost:8000/ExamService/service";NetTcpBinding binding1=new

NetTcpBinding();using(ServiceHost host=new ServiceHost(typeof(ExamService))){ host.AddServiceEndpoint(typeof(IExam),binding1,baseAddress);}

Answer: B

Question: 8

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

Page 3 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You write the following code fragment in the service configuration file. (Line numbers are included for reference only.)

01 <system.serviceModel>

02 ...

03 <behaviors>

04 <serviceBehaviors>

05 <behavior name="CalculatorServiceBehavior">

06 <CustomServiceBehavior/>

07 </behavior>

08 </serviceBehaviors>

09 </behaviors>

10

11 </system.serviceModel>

You need to register the custom service behavior in the service configuration file. Which code fragment should you insert at line 10?

A.<behaviorExtensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /></behaviorExtensions>

B.<extensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /></extensions>

C.<behaviorExtensions> <extensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /> </extensions> </behaviorExtensions>

D.<extensions> <behaviorExtensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /> </behaviorExtensions></extensions>

Answer: D

Question: 9

You are creating an application in Windows Communication Foundation (WCF) by using Microsoft.NET Framework 3.5.

You need to ensure that the client application communicates with the service by using a duplex contract.

Which five actions should you perform? (To answer, move the five appropriate actions from the list of actions to the answer area, and arrange them in the correct order.)

Page 4 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application
  Developer    
Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer:

Question: 10

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a Console application. You need to configure the service by using a configuration file other than the default app.config file. Which code segment should you use?

A.class MyServiceHost : ServiceHost{ public MyServiceHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { } protected override void InitializeRuntime() {

//Load configuration here }}

B.class MyServiceHost : ServiceHost{ public MyServiceHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { } protected override void ApplyConfiguration() {

//Load configuration here }}

C.class MyServiceHost : ServiceHost{ public MyServiceHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { } protected new void InitializeDescription(Type

serviceType, UriSchemeKeyedCollection baseAddresses) { //Load configuration here. }}

D.class MyServiceHost : ServiceHost{ public MyServiceHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { } protected new void AddBaseAddress(Uri

Page 5 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

baseAddress) { //Load configuration here. }}

Answer: B

Question: 11

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following binding configuration in the configuration file. (Line numbers are included for reference only.)

01 <wsHttpBinding>

02 <binding name="ssl">

03

04 </binding>

05 </wsHttpBinding>

You need to ensure that the following requirements are met: The service must use transport-level security (SSL via HTTPS).

The service must use message-level security to authenticate client applications by using user name and password.

Which configuration setting should you insert at line 03?

A.<security mode="Message"> <message clientCredentialType="UserName"/></security>

B.<security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName"/></security>

C.<security mode="Transport"> <transport clientCredentialType="Windows"/> <message clientCredentialType="UserName"/></security>

D.<security mode="Message" > <transport clientCredentialType="Windows" /> <message clientCredentialType="UserName" /></security>

Answer: B

Question: 12

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The service will authenticate the client applications by using Personal Information Cards. You write the following code segment. (Line numbers are included for reference only.)

01 public class CustomServiceAuthorizationManager :

02 ServiceAuthorizationManager {

03 protected override bool CheckAccessCore(OperationContext

04 operationContext)

05 {

06 string action=

07 operationContext.RequestContext.RequestMessage.

08 Headers.Action;

09 if (action == "http://tempuri.org/IEngine/Update")

10{

11foreach (ClaimSet cs in

12operationContext.ServiceSecurityContext.AuthorizationContext.

13ClaimSets)

14{

15

16 }

17 return false;

18 }

Page 6 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

19 return true;

20}

21bool IsEmailValid(string email)

22{

23//e-mail validation is performed here;

24return true;

25}

26

You need to ensure that only those client applications that provide a valid e-mail address can execute the Update method.

Which code segment should you insert at line 15?

A.foreach (Claim c in cs.FindClaims("http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress", "PossessProperty")) return IsEmailValid(c.Resource.ToString());

B.foreach (Claim c in cs.FindClaims("http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress", string.Empty)) return IsEmailValid(c.Resource.ToString());

C.foreach (Claim c in cs.FindClaims("http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress", Rights.PossessProperty)) return IsEmailValid(c.Resource.ToString());

D.foreach (Claim c in cs.FindClaims("http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress", Rights.Identity)) return IsEmailValid(c.Resource.ToString());

Answer: C

Question: 13

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation to create the application.

You plan to perform the following tasks:

Authenticate the client applications by using Microsoft ASP.NET membership provider. Authorize the client applications by using Microsoft ASP.NET role provider.

You write the following code segment. [ServiceContract]

public interface IService{ [OperationContract] void Remove(int id);

}

public class Service : IService

{

public void Remove(int id)

{

}

}

You need to ensure that only those client applications that provide credentials belonging to the AdminGroup role can access the Remove method.

What should you do?

A.Add the following attribute to the Remove method of the Service class. [PrincipalPermission(SecurityAction.Demand, Role="AdminGroup")]

B.Add the following attribute to the Remove method of the IService interface. [PrincipalPermission(SecurityAction.Demand, Role="AdminGroup")]

C.Add the following attribute to the Service class. [PrincipalPermission(SecurityAction.Demand, Name="Remove", Role="AdminGroup")]

D.Add the following attribute to the Service class. [PrincipalPermission(SecurityAction.Demand,

Page 7 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Name="IService.Remove", Role="AdminGroup")]

Answer: A

Question: 14

You are creating a client application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation (WCF) to create the application.

The client application uses a Personal Information Card to provide authentication information to the WCF server.

You write the following code fragment. (Line numbers are included for reference only.)

01 <wsFederationHttpBinding>

02 <binding name="requireCardSpace">

03 <security mode="Message">

04 <message >

05

06 </message>

07 </security>

08 </binding>

09 </wsFederationHttpBinding>

You need to ensure that one of the claims in the Personal Information Card contains an e-mail address.

Which code fragment should you insert at line 05?

A.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress" isOptional="false"/></claimTypeRequirements><issuer address="http:

//schemas.xmlsoap.org/ws/2005/05/identity/issuer/personal"/>

B.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress"/></claimTypeRequirements><issuer address="http: //schemas.xmlsoap.org/ws/2005/05/identity/issuer/personal"/>

C.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress"/></claimTypeRequirements><issuer address="http: //schemas.xmlsoap.org/ws/2005/05/identity/issuer/managed"/>

D.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress" isOptional="false"/></claimTypeRequirements><issuer address="http:

//schemas.xmlsoap.org/ws/2005/05/identity/issuer/self"/>

Answer: D

Question: 15

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The client applications are unable to use SSL. You need to ensure that clients authenticate by using a token provided by a Security Token Service (STS). What should you do?

A.Use a BasicHttpBinding binding with the security mode set to Message.

B.Use a BasicHttpBinding binding with the security mode set to TransportWithMessageCredential.

C.Use a WSFederationHttpBinding binding with the security mode set to Message.

D.Use a WSFederationHttpBinding binding with the security mode set to TransportWithMessageCredential.

Page 8 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer: C

Question: 16

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code fragment for the configuration setting. (Line numbers are included for reference only.)

01 <wsHttpBinding>

02 <binding name="simple">

03

04 </binding>

05 </wsHttpBinding>

You need to ensure that the service uses transport security and allows access to anonymous client applications.

Which code fragment should you insert at line 03?

A.<security mode="Transport" > <transport clientCredentialType="Basic" /></security>

B.<security mode="Transport" > <message clientCredentialType="None"/></security>

C.<security mode="Transport" > <message clientCredentialType="Certificate"/></security>

D.<security mode="Transport" > <transport clientCredentialType="None" /></security>

Answer: D

Question: 17

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation (WCF) to create the application. The operations provided by the WCF server use the remote resources of other computers. These methods use the credentials provided by the client applications. You need to ensure that the WCF server can impersonate the client applications to access the remote resources. Which client application settings should you use?

A.<windows allowedImpersonationLevel="Delegation"/>

B.<windows allowedImpersonationLevel="Impersonation"/>

C.<windows allowedImpersonationLevel="Identification"/>

D.<windows allowedImpersonationLevel="Impersonation" allowNtlm="false"/>

Answer: A

Question: 18

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment.

01 [ServiceContract]

02 public interface IMyService

03 {

04 [OperationContract]

05 void MyMethod();

06 }

07

08 public class ServiceImpl:IMyService

09 {

10 [OperationBehavior(TransactionScopeRequired=true)]

Page 9 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

11 public void MyMethod() { }

12 }

You need to ensure that concurrent calls are allowed on the service instance. Which code segment should you insert at line 07?

A.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, ReleaseServiceInstanceOnTransactionComplete=true)]

B.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, ReleaseServiceInstanceOnTransactionComplete=false)]

C.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Reentrant, ReleaseServiceInstanceOnTransactionComplete=true)]

D.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Reentrant, ReleaseServiceInstanceOnTransactionComplete=false)]

Answer: B

Question: 19

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You create the following service contract. [ServiceContract]

public interface IMyService

{

[OperationContract] void DoSomething();

}

The service will not use any external resources.

You need to ensure that the calls to the DoSomething operation are thread-safe.

What are the two possible service implementations that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

A.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.Single)]public class ServiceImpl : IMyService{ public void

DoSomething() { }}

B.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single, InstanceContextMode=InstanceContextMode.Single)]public class ServiceImpl : IMyService{ public void

DoSomething() { }}

C.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.PerSession)]public class ServiceImpl : IMyService{ public void

DoSomething() { }}

D.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.PerCall)]public class ServiceImpl : IMyService{ public void

DoSomething() { }}

Answer: B, D

Question: 20

You create a stateless, thread-safe service by using Microsoft .NET Framework 3.5. You use the Windows Communication Foundation model to create the service. Load testing reveals that the service does not scale above 1,000 concurrent users. You discover that each call to the service

Page 10 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

instantiates a new service instance. You also discover that these service instances are expensive to create. You need to ensure that 5,000 concurrent users can access the service. Which code segment should you use?

A.[ServiceBehavior( InstanceContextMode=InstanceContextMode.PerCall, ConcurrencyMode=ConcurrencyMode.Reentrant)]

B.[ServiceBehavior( InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Multiple)]

C.[ServiceBehavior( InstanceContextMode=InstanceContextMode.PerCall, ConcurrencyMode=ConcurrencyMode.Multiple)]

D.[ServiceBehavior( InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Reentrant)]

Answer: B

Question: 21

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You create the following service definition. [ServiceContract(SessionMode=SessionMode.Required)] public interface IMyService

{

...

}

You need to custom manage the lifetime of the session. Which service implementation should you use?

A.[ServiceBehavior(AutomaticSessionShutdown=true)]public class ServiceImpl{ ...}

B.[ServiceBehavior(AutomaticSessionShutdown=false)]public class ServiceImpl{ ...}

C.[ServiceBehavior(UseSynchronizationContext=true)]public class ServiceImpl{ ...}

D.[ServiceBehavior(UseSynchronizationContext=false)]public class ServiceImpl{ ...}

Answer: B

Question: 22

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment. 01 [ServiceContract]

02 public interface IMyService

03 {

04 [OperationContract]

05 void MyMethod();

06 }

07 public class SeviceImpl : IMyService

08 {

09

10 public void MyMethod() { }

11 }

You need to ensure that when the MyMethod method is called, the service is the root of a transaction.

Which code segment should you insert at line 09?

Page 11 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A. [OperationBehavior(TransactionScopeRequired=true)][TransactionFlow(TransactionFlowOption.A llowed)]

B. [OperationBehavior(TransactionScopeRequired=true)][TransactionFlow(TransactionFlowOption. NotAllowed)]

C. [OperationBehavior(TransactionScopeRequired=false)][TransactionFlow(TransactionFlowOption. Mandatory)]

D. [OperationBehavior(TransactionScopeRequired=false)][TransactionFlow(TransactionFlowOption. NotAllowed)]

Answer: B

Question: 23

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment for the service contract. (Line numbers are included for reference only.)

01 [ServiceContract]

02

03 public class MyService

04 {

05 ...

06 }

The service uses transactions that time out in a minute.

You need to increase the timeout interval of the transactions to 2 minutes and 30 seconds. Which code segment should you insert at line 02?

A.[ServiceBehavior(TransactionTimeout="150")]

B.[ServiceBehavior(TransactionTimeout="0:2:30")]

C.[ServiceBehavior(TransactionTimeout="2:30:00")]

D.[ServiceBehavior(TransactionTimeout="0:150:00")]

Answer: B

Question: 24

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You configure a binding to enable streaming. You need to ensure that the client application is able to stream large XML files to the WCF service. Which operation contract should you create?

A.[OperationContract]void UploadFile(Stream xmlData);

B.[OperationContract]void UploadFile(XmlWriter xmlData);

C.[OperationContract]void UploadFile(StreamWriter xmlData);

D.[OperationContract]void UploadFile(byte[] xmlData);

Answer: A

Question: 25

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

Page 12 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You write the following code segment for the service implementation. (Line numbers are included for reference only.)

01 public void PutMessage(Message msg)

02 {

03 string value=null;

04

05 }

You need to retrieve the content from the received message body and store it in the variable named value.

Which code segment should you insert at line 04?

A.value=msg.GetBody<string>();

B.string ns=msg.Headers.GetHeader<string>(0);value=msg.GetBodyAttribute("Body", ns);

C.XmlReader reader=msg.GetBody<XmlReader>();value=reader.ReadOuterXml();

D.XmlReader reader=msg.GetReaderAtBodyContents();value=reader.ReadOuterXml();

Answer: D

Question: 26

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment. (Line numbers are included for reference only.)

01 [ServiceContract(Namespace="http://uri.contoso.com")]

02 public interface IMyService

03 {

04 [OperationContract]

05 string ProcessDetails(string s);

06 [OperationContract(Action="UpdateStatus")]

07 void UpdateStatus();

08

09 }

If the existing operation contract is unable to process a request made to the service, a generic operation contract must attempt to process the request.

You need to create the generic operation contract. Which code segment should you insert at line 08?

A.[OperationContract(Action="*")]void ProcessOthers(Message msg);

B.[OperationContract(Action="*")]void ProcessOthers();

C.[OperationContract(Action="Default")]void ProcessOthers(Message msg);

D.[OperationContract(Action="Default")]void ProcessOthers();

Answer: A

Question: 27

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment. [ServiceContract]

public interface IMyService

{

[OperationContract(IsOneWay=true, ProtectionLevel=ProtectionLevel.None)]

Page 13 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

[TransactionFlow(TransactionFlowOption.Allowed)] void DoSomething();

}

You need to ensure that the DoSomething operation can participate in transactions. Which code segment should you use to replace the existing operation contract?

A. [OperationContract(ProtectionLevel=ProtectionLevel.None)][TransactionFlow(TransactionFlowOp tion.Allowed)]void

DoSomething();

B.[OperationContract(ProtectionLevel= ProtectionLevel.EncryptAndSign)][TransactionFlow(TransactionFlowOption.NotAllowed)]void DoSomething();

C.[OperationContract(IsOneWay=true, ProtectionLevel=ProtectionLevel.EncryptAndSign)][TransactionFlow(TransactionFlowOption.Allo wed)]void

DoSomething();

D.[OperationContract(IsOneWay=true, ProtectionLevel=ProtectionLevel.Sign)][TransactionFlow(TransactionFlowOption.Mandatory)]void DoSomething();

Answer: A

Question: 28

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You have successfully defined a service contract named IManageOrders.

You write the following code segment.

public class OrderImpl : IManageOrders { public void MarkOrderClosed(int orderId){ try {

...

}

catch (SqlException exc){

throw new FaultException<DataFault>(new DataFault());

}

}

}

[DataContract]

public class DataFault {

}

You need to create a fault contract for the MarkOrderClosed method on the IManageOrders service contract.

Which code segment should you add?

A.[FaultContract(typeof(DataFault))]

B.[FaultContract(typeof(Exception))]

C.[FaultContract(typeof(SqlException))]

D.[FaultContract(typeof(FaultException))]

Answer: A

Question: 29

Page 14 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to ensure that the service can send data in the following format to the client applications.

<Account Id=""> <Name> </Name>

<Balance Currency=""> </Balance> </Account>

Which code segment should you use?

A. [Serializable]public class Account{ [XmlAttribute] public string Id; [XmlElement] public string
Name; [XmlAttribute] public string Currency; [XmlElement] public double Balance;}  

B.[DataContract]public class Account{ [DataMember(Order=0)] public string Id; [DataMember(Order=1)] public string Name; [DataMember(Order=0)] public double Balance; [DataMember(Order=1)] public string Currency;}

C.[Serializable]public class Account{ [XmlAttribute] public string Id; public string Name; [XmlElement("Balance")] public BalanceVal Balance;}[Serializable]public class BalanceVal{ [XmlText] public double Amount; [XmlAttribute] public string Currency;}

D.[DataContract]public class Account{ [DataMember(Order=0)] public string Id; [DataMember(Order=1)] public string Name; [DataMember(Name="Balance", Order=2)] public BalanceVal Balance;}[DataContract]public struct BalanceVal{ [DataMember(Order=0)] public double Balance; [DataMember(Order=1)] public string Currency;}

Answer: C

Question: 30

You create a Windows Communication Foundation client application by using Microsoft .NET Framework 3.5. The client application communicates with an existing Web service that requires custom HTTP headers. You need to ensure that all messages sent to the service include the headers. Which two tasks should you perform? (Each correct answer presents part of the solution.

Choose two.)

A.Create a message inspector. Insert the custom headers by using the IClientMessageInspector.AfterReceiveReply method.

B.Create a message inspector. Insert the custom headers by using the IClientMessageInspector.BeforeSendRequest method.

C.Create a custom endpoint behavior. Add the message inspector by using the IEndpointBehavior.ApplyClientBehavior method.

D.Create a custom endpoint behavior. Add the message inspector by using the IEndpointBehavior.AddBindingParameters method.

Answer: B, C

Question: 31

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. The WCF service contains two operations named ProcessSimpleOrder and ProcessComplexOrder. You need to expose the ProcessSimpleOrder operation to all the client applications. You also need to expose the ProcessComplexOrder operation only to specific client applications. Which code segment should you use?

A.[ServiceContract]public interface IOrderManager{ [OperationContract(Action="*")] void ProcessSimpleOrder(); [OperationContract] void ProcessComplexOrder();}

B.[ServiceContract]public interface IOrderManager{ [OperationContract(Name="http:

Page 15 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

//contoso.com/Simple")] void ProcessSimpleOrder(); [OperationContract(Name="http: //contoso.com/Complex")] void ProcessComplexOrder();}

C.[ServiceContract]public interface ISimpleOrderManager{ [OperationContract] void ProcessSimpleOrder();}[ServiceContract]public interface IComplexOrderManager: ISimpleOrderManager{

[OperationContract] void ProcessComplexOrder();}

D.[ServiceContract]public interface ISimpleOrderManager{ [OperationContract(Name="http: //contoso.com/Simple")] void ProcessSimpleOrder();}public interface IComplexOrderManager: ISimpleOrderManager{ [OperationContract(Name="http: //contoso.com/Complex")] void ProcessComplexOrder();}

Answer: C

Question: 32

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You want to enable message logging.

You add the following code fragment to the service configuration file.

<system.diagnostics> <sources>

<source name="System.ServiceModel.MessageLogging"> <listeners>

<add name="messages" type="System.Diagnostics.XmlWriterTraceListener" /> </listeners>

</source> </sources> </system.diagnostics>

You receive an exception.

You need to successfully enable message logging.

What should you do?

A.Remove the message filter.

B.Set the switchValue attribute to verbose.

C.Set the initializeData attribute to the name of a log file.

D.Set the maximum size of the message to be logged to 256K.

Answer: C

Question: 33

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

Client applications that run on different platforms access the WCF service. These applications transmit confidential data to the WCF service.

You write the following binding configuration

....

<binding name="TransportSecurity" > <security mode="Transport" /> </binding>

...

You need to configure the service for optimum interoperability and optimum security. Which code fragment should you use?

Page 16 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="wsHttpBinding" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="http: //localhost:80/Service/"/> </baseAddresses> </host></service>

B.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="basicHttpBinding" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="http: //localhost:80/Service/"/> </baseAddresses> </host></service>

C.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="https: //localhost:443/Service/"/> </baseAddresses> </host></service>

D.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="https: //localhost:443/Service/"/> </baseAddresses> </host></service>

Answer: C

Question: 34

You create a service by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation to create the service. You use the WSHttpBinding binding to prevent tampering of the data. Users report that the data is unreadable. You need to troubleshoot the problem by logging the incoming messages. Which code fragment should you use?

A.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtTransportLevel="true"/> </diagnostics></system.serviceModel>

B.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true"/> </diagnostics></system.serviceModel>

C.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="true"/> </diagnostics></system.serviceModel>

D.<system.serviceModel> <diagnostics> <messageLogging logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/> </diagnostics></system.serviceModel>

Answer: B

Question: 35

You create a client application by using Microsoft .NET Framework 3.5. The client application uses a Windows Communication Foundation (WCF) service. You plan to implement inspection handling on the client application and the WCF service. You need to add error handling to the WCF service. What should you do?

A.Modify the BeforeSendReply method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

B.Modify the BeforeSendRequest method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

C.Modify the AfterReceiveRequest method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

D.Modify the AfterReceiveReply method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

Answer: A

Page 17 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Question: 36

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You set up tracing for the service. The tracing fails because of an error in the service configuration. You need to identify the cause of the error. What should you do?

A.Examine the system event log.

B.Examine the security event log.

C.Examine the application event log.

D.Set the enableLogKnownPii attribute to true in the machine.config file.

Answer: C

Question: 37

You are creating a client application by using Microsoft .NET Framework 3.5. The client application uses a Windows Communication Foundation service.

To log the called service proxy methods and their parameters, you implement custom endpoint behavior in the following class.

class ParametersLoggerBehavior : IEndpointBehavior

{

}

You also create the following class for the custom behavior. class LoggerElement : BehaviorExtensionElement

{

}

You add the following configuration code fragment to the application configuration file. (Line numbers are included for reference only.)

01 <behaviors>

02 <endpointBehaviors>

03

04 </endpointBehaviors>

05 </behaviors>

06 <extensions>

07 <behaviorExtensions>

08 <add name="debugBehavior" type="Client.LoggerElement,

09 ClientApp, Version=1.0.0.0, Culture=neutral,

10 PublicKeyToken=null"/>

11 </behaviorExtensions>

12 </extensions>

You need to ensure that the endpoint uses the custom behavior.

Which configuration settings should you insert at line 03?

A.<debugBehavior name="debug" />

B.<behavior name="debug"> <debugBehavior /></behavior>

C.<behavior name="debug"> <ParametersLoggerBehavior /></behavior>

D.<ParametersLoggerBehavior name="debug"> <debugBehavior /></ParametersLoggerBehavior>

Answer: B

Question: 38

You are creating a Windows Communication Foundation (WCF) client application by using Microsoft .NET Framework 3.5. The WCF service transfers data to the client applications by using

Page 18 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

the streaming transfer mode. You need to create an endpoint that supports the streaming transfer mode. Which binding should you use?

A.wsHttpBinding

B.basicHttpBinding

C.webHttpBinding

D.wsFederationHttpBinding

Answer: B

Question: 39

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5.

The client application consumes the Web Services Enhancements (WSE) 3.0 Web service. The Web service uses standard WSE 3.0 to transfer binary data to the client application.

The client application uses the following binding configuration. (Line numbers are included for reference only.)

01 <customBinding>

02 <binding name="custom" >

03

04 <httpTransport maxBufferSize="700000" 04 maxReceivedMessageSize="700000" />

05 </binding>

06 </customBinding>

You need to ensure that the client application receives binary data from the WSE 3.0 Web service.

Which code fragment should you insert at line 03?

A.<binaryMessageEncoding maxReadPoolSize="700000" />

B.<binaryMessageEncoding > <readerQuotas maxBytesPerRead="700000" /></binaryMessageEncoding>

C.<binaryMessageEncoding > <readerQuotas maxArrayLength="700000"/></binaryMessageEncoding>

D.<mtomMessageEncoding messageVersion="Soap12WSAddressingAugust2004"> <readerQuotas

maxArrayLength="700000"/></mtomMessageEncoding>

Answer: D

Question: 40

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5.

You add the following code segment to a service contract. [ServiceContract]

interface IDocumentService

{

[OperationContract]

int DeleteDocument(int id);

}

The DeleteDocument method in the service contract takes a long time to execute. The client application stops responding until the method finishes execution.

You write the following code segment to create an instance of a service proxy in the client application.

Page 19 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

(Line numbers are included for reference only.)

01 static void Main()

02 {

03 DocumentServiceClient client=

04 new DocumentServiceClient();

05

06 }

07 static void ProcessDeleteDocument(IAsyncResult result)

08 {

09

10 }

You need to ensure that the service methods are called asynchronously.

What should you do?

A.Insert the following code segment at line 05. client.BeginDeleteDocument(20, ProcessDeleteDocument,

client); Insert the following code segment at line 09. int count=(result.AsyncState as DocumentServiceClient).EndDeleteDocument(null);

B.Insert the following code segment at line 05. client.BeginDeleteDocument(20, ProcessDeleteDocument,

client); Insert the following code segment at line 09. result.AsyncWaitHandle.WaitOne();int count=(result as

DocumentServiceClient).EndDeleteDocument(result);

C.Insert the following code segment at line 05. client.BeginDeleteDocument(20, ProcessDeleteDocument,

client); Insert the following code segment at line 09. int count=(result.AsyncState as DocumentServiceClient).EndDeleteDocument(result);

D.Insert the following code segment at line 05. IAsyncResult result= client.BeginDeleteDocument(20,

ProcessDeleteDocument, client);int count=client.EndDeleteDocument(result); Insert the following code

segment at line 09. result.AsyncWaitHandle.WaitOne();

Answer: C

Question: 41

You are creating a Windows Communication Foundation application by using Microsoft .NET Framework 3.5.

The application must consume an ATOM 1.0 feed published at http://localhost:8000/BlogService/GetBlog.

You write the following code segment. (Line numbers are included for reference only.)

01 Uri address = new

02 Uri("http://localhost:8000/BlogService/GetBlog");

03

04 Console.WriteLine(feed.Title.Text);

You need to ensure that the application prints the title of the feed.

Which code segment should you insert at the line 03?

A.SyndicationFeed feed = SyndicationFeed.Load(address);

B.SyndicationFeed feed = new SyndicationFeed();feed.BaseUri = address;

Page 20 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

C.SyndicationItem item = SyndicationItem.Load(address);SyndicationFeed feed = new SyndicationFeed();feed.Items = new SyndicationItem[] { item };

D.SyndicationItem item = new SyndicationItem();item.BaseUri = address;SyndicationFeed feed = new

SyndicationFeed();feed.Items = new SyndicationItem[] { item };

Answer: A

Question: 42

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

You add the following code segment to the service. public interface ICalulatorService

{

[OperationContract] [FaultContract(typeof(ArithmeticException))] double Divide(double number1, double number2); [OperationContract]

void DisposeCalculator();

}

[ServiceBehavior(IncludeExceptionDetailInFaults=true)] public class CalculatorService : ICalulatorService

{

public double Divide(double number1, double number2)

{

if (number2 == 0)

throw new DivideByZeroException(); return (number1 / number2);

}

public void DisposeCalculator()

{

// release resources.

...

}

}

You add the following code segment to the client application.

01 public double PerformCalculations(double num1, double num2)

02 {

03

04 }

You need to ensure that the DisposeCalculator operation is always called.

Which code segment should you insert at line 03?

A.CalculatorClient proxy=new CalculatorClient();int result=-1;try { result=proxy.Divide(number1, number2);}catch (DivideByZeroException dzEx) {}proxy.DisposeCalculator();return result;

B.CalculatorClient proxy=new CalculatorClient();int result=-1;try { result=proxy.Divide(number1, number2);}catch (DivideByZeroException dzEx) { proxy.Close(); proxy=new CalculatorClient();}proxy.DisposeCalculator();return result;

C.CalculatorClient proxy=new CalculatorClient();int result=-1;try { result = proxy.Divide(number1, number2);}catch (FaultException dzEx) {} proxy.DisposeCalculator();return result;

D.CalculatorClient proxy=new CalculatorClient();int result=-1;try { result=proxy.Divide(number1, number2);}catch (FaultException dzEx) { proxy.Close(); proxy=new

Page 21 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

CalculatorClient();}proxy.DisposeCalculator();return result;

Answer: D

Question: 43

You are creating a client application that will call a Windows Communication Foundation service. The service was created by using Microsoft .NET Framework 3.5.

You write the following code segment.

[DataContract]

public class CreditCard { [DataMember]

public string Name { get; set; } [DataMember]

public string CardNumber { get {

return cardNumber;

}

set {

if (!IsValidCreditCardNumber(value)) {

throw new ArgumentException("Invalid credit card number");

}

cardNumber = value;

}

}

}

You plan to share the validation logic between the client application and the WCF service. You need to generate a client-side service proxy that includes the validation logic.

Which four tasks should you perform? (Each correct answer presents part of the solution. Choose four.)

A.Create a Class Library project for the DataContract classes.

B.In the Service project, add a reference to the Class Library project.

C.In the Client project, add a reference to the Class Library project.

D.In the Client project, use the Add Web Reference dialog box to reference the service.

E.In the Client project, use the Add Service Reference dialog box to reference the service.

F.In the Client project, use the Add Reference dialog box to add a project reference to the Service project.

Answer: A, B, C, E

Question: 44

You are creating a client application by using Microsoft .NET Framework 3.5.

The client application will consume a COM+ application by using the Windows Communication Foundation service.

You write the following code segment to implement the COM+ application. [Guid("InterfaceGuidIsHere")]

public interface IDocumentStore

{

bool IsDocumentExist(long id);

}

[Guid("ClassGuidIsHere")]

public class DocumentStore: ServicedComponent, IDocumentStore

Page 22 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

{

public bool IsDocumentExist(long id)

{

//This code checks if document exists.

}

}

The application ID of the COM+ application is {AppGuidIsHere}.

You need to configure the WCF service to access the COM+ application from the WCF client application. Which code fragment should you use?

A.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="IDocumentStore"/> </service></services>

B.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="{InterfaceGuidIsHere}"/> </service></services>

C.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="DocumentStorage.IDocumentStore"/> </service></services>

D.<services> <service name="{AppGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="{InterfaceGuidIsHere}"/> </service></services>

Answer: B

Question: 45

You create a client application by using Microsoft .NET Framework 3.5.

The client application consumes a Windows Communication Foundation service that uses the netMsmqBinding binding.

The binding uses a private transactional queue named Library.

The following code fragment is part of the application configuration file. (Line numbers are included for reference only.)

01 <endpoint binding="netMsmqBinding"

02 contract="ServiceReference.ILibrary"

03

04 />

You need to specify the address of the endpoint.

Which attribute should you insert at line 03?

A.address=".\private$\Library"

B.address="net.msmq://.\private$\Library"

C.address="net.msmq://localhost/private/Library"

D.address="net.msmq://localhost/private/transactional/Library"

Answer: C

Question: 46

You create a Windows Communication Foundation (WCF) application by using Microsoft .NET Framework 3.5. The desktop client calls the WCF service to query its status. The call can take up to 10 seconds to complete. The client application must remain responsive when querying the service. You need to generate the required proxy. What should you do?

A.Execute the svcutil http: //localhost:8000/MyWCF /async command.

B.Execute the svcutil myServiceHost.exe /serviceName:MyWCF command.

C.Execute the svcutil /validate /serviceName:MyWCF myServiceHost.exe command.

Page 23 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

D.Clear the Generate asynchronous operation check box in the Add Service Reference Settings dialog box.

Answer: A

Question: 47

You are creating a Windows Communication Foundation (WCF) client application by using Microsoft .NET Framework 3.5.

The proxy generated for the WCF service results in the following code segment. [ServiceContract(CallbackContract=typeof(IStoreCallback))]

public interface IStore

{

[OperationContract(IsOneWay=true)] void CheckAvailableProducts();

}

public interface IStoreCallback

{

}

To implement a callback interface, you create the following class in the client application. public class StoreCallback: IStoreCallback

{

}

The client application receives notifications from the service through the callback interface.

You write the following code segment for the client application to use the generated proxy. (Line numbers are included for reference only.)

01

02 client.CheckAvailableProducts();

You need to set up duplex communication between the client application and the WCF service. Which code segment should you insert at line 01?

A.StoreClient client=new StoreClient( new InstanceContext(typeof(StoreCallback)));

B.StoreClient client= new StoreClient(OperationContext.Current.InstanceContext);

C.StoreClient client=new StoreClient(new InstanceContext( new StoreCallback()));

D.IStoreCallback callback= OperationContext.Current.GetCallbackChannel <ServiceReference.IStoreCallback>();InstanceContext context=new InstanceContext(callback);StoreClient

client= new ServiceReference.StoreClient(context);

Answer: C

Question: 48

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The WCF service must authenticate the client applications by validating credit card numbers and expiry dates.

You write the following code segment. (Line numbers are included for reference only.)

01 class CreditCardTokenAuthenticator : SecurityTokenAuthenticator

02 {

03 // Implementation of other abstract methods comes here.

04 protected override

05 ReadOnlyCollection<IAuthorizationPolicy>

06 ValidateTokenCore(SecurityToken token)

07 {

Page 24 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

08 CreditCardToken creditCardToken =

09 token as CreditCardToken;

10

11}

12private bool IsCardValid(string cardNumber,

13DateTime expirationDate )

14{

15// Validation code comes here.

16}

17}

You need to implement custom authentication for the WCF service.

Which code segment should you insert at line 10?

A.if (IsCardValid(creditCardToken.CardNumber, creditCardToken.ValidTo)) return null;else throw new

SecurityTokenValidationException();

B.if (IsCardValid(creditCardToken.CardNumber, creditCardToken.ValidTo)) throw new SecurityTokenValidationException();else return null;

C.if (IsCardValid(creditCardToken.CardNumber, creditCardToken.ValidTo)) return null;else return new

List<IAuthorizationPolicy>(0).AsReadOnly();

D.if (IsCardValid(creditCardToken.CardNumber, creditCardToken.ValidTo)) return new List<IAuthorizationPolicy>(0).AsReadOnly();else return null;

Answer: D

Question: 49

You are creating a distributed application by using Microsoft .NET Framework 3.5. The application uses the Windows Communication Foundation model.

You need to ensure that the following requirements are met: User authentication is performed at the message level. Data protection is performed at the transport level.

Server authentication is performed at the transport level.

What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

A.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > </security> </binding> </wsHttpBinding></bindings>

B.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Certificate" /> <message clientCredentialType="None"/> </security> </binding> </wsHttpBinding></bindings>

C.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Windows" /> <message clientCredentialType="None"/> </security> </binding> </wsHttpBinding></bindings>

D.<bindings> <netTcpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Certificate" /> <message clientCredentialType="Certificate"/> </security> </binding> </netTcpBinding></bindings>

Answer: A, D

Question: 50

Page 25 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation (WCF) to create the application. The client application is used in Company A, and the service application is used in Company B. Company A and company B have security token services named STS_A and STS_B respectively. You need to authenticate the client application by using federated security. Which combination of bindings should you use?

A.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF service wsFederationHttpBinding for the STS_A servicewsFederationHttpBinding for the STS_B service

B.wsFederationHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsHttpBinding for the STS_A servicewsHttpBinding for the STS_B service

C.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsHttpBinding for the STS_A servicewsFederationHttpBinding for the STS_B service

D.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsFederationHttpBinding for the STS_A servicewsHttpBinding for the STS_B service

Answer: B

Question: 51

You are creating a distributed application by using Microsoft .NET Framework 3.5. The application uses Windows Communication Foundation (WCF). The distributed application provides point-to-point security. You need to ensure that the distributed application provides end- to-end security instead of point-to-point security. Which binding mode should you use?

A.netTcpBinding with Transport security

B.wsHttpBinding with Transport security

C.wsHttpBinding with Message security

D.netNamedPipeBinding with Transport security

Answer: C

Question: 52

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The WCF service will validate certificates to authorize client applications. You write the following code segment.

class Store: IStore

{

public void RemoveOrder(int ordered)

{

}

}

You need to ensure that only those client applications that meet the following criteria can access the

RemoveOrder method:

"AdminUser" is the subject in the client certificate. "1bf47e90f00acf4c0089cda65e0aadcf1cedd592" is the thumbprint in the client certificate. What should you do?

A. Decorate the RemoveOrder method by using the following attribute. [PrincipalPermission(SecurityAction.Demand, Name="AdminUser; 1bf47e90f00acf4c0089cda65e0aadcf1cedd592")] Initialize the serviceAuthorization element of the service

behavior in the following manner. <serviceAuthorization principalPermissionMode="Windows"/>

Page 26 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.Decorate the RemoveOrder method by using the following attribute. [PrincipalPermission(SecurityAction.Demand, Role="CN=AdminUser, 1bf47e90f00acf4c0089cda65e0aadcf1cedd592")] Initialize the serviceAuthorization element of the service

behavior in the following manner. <serviceAuthorization principalPermissionMode="Windows"/>

C.Decorate the RemoveOrder method by using the following attribute. [PrincipalPermission(SecurityAction.Demand, Role="AdminUser, 1bf47e90f00acf4c0089cda65e0aadcf1cedd592")] Initialize the serviceAuthorization element of the service

behavior in the following manner. <serviceAuthorization principalPermissionMode="UseAspNetRoles"/>

D.Decorate the RemoveOrder method by using the following attribute. [PrincipalPermission(SecurityAction.Demand, Name = "CN=AdminUser; 1bf47e90f00acf4c0089cda65e0aadcf1cedd592")] Initialize the serviceAuthorization element of the service

behavior in the following manner. <serviceAuthorization principalPermissionMode="UseAspNetRoles"/>

Answer: D

Question: 53

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following XML code fragment. <service name="Contoso.Exams.ExamService" behaviorConfiguration="ExamServiceBehavior"> <host>

<baseAddresses>

<add baseAddress="http://localhost:8000/ServiceModelExam/service"/> </baseAddresses>

</host> </service>

You need to add an endpoint definition to the service configuration for the URL http://localhost:8000/ServiceModelExam/service to expose the Contoso.Exams.IExam service contract.

Which definition should you add?

A.<endpoint address=""binding="wsHttpBinding" contract="Contoso.Exams.IExam" />

B.<endpoint address="/service" binding="wsHttpBinding" contract="Contoso.Exams.IExam" />

C.<endpoint address="/service" binding="basicHttpBinding" contract="Contoso.Exams.IExam" />

D.<endpoint address="http: //localhost:8000/ServiceModelExam/service" binding="basicHttpBinding" contract="IExam" />

Answer: A

Question: 54

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a Windows Service environment. You need to create a Windows Service class that instantiates a service host. Which code segment should you use?

A. public class WindowsExamService : ServiceController{ private ServiceHost serviceHost; public new void

Start() { serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open(); }}

Page 27 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.public class WindowsExamService : ServiceHostBase{ private ServiceHost serviceHost; public new void

Open() { serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open(); }}

C.public class WindowsExamService : ServiceBase{ private ServiceHost serviceHost; protected override

void OnStart(string[] args) { serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open();

}}

D.public class WindowsExamService : ServiceHost{ private ServiceHost serviceHost; public new void

Open() { serviceHost=new ServiceHost(typeof(ExamService)); serviceHost.Open(); }}

Answer: C

Question: 55

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a managed Console application. The service endpoint has an address that is relative to the base address of the service. You need to programmatically add the base address to the service. What should you do?

A.Call a constructor of the ServiceHost class.

B.Call an AddServiceEndpoint method of the ServiceHost class.

C.Create and add a custom endpoint behavior to the service.

D.Create and add a custom operation behavior to the service.

Answer: A

Question: 56

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You need to use a custom service host to host the WCF service in Windows Activation Services (WAS). What should you do?

A.Write hosting code for the WCF service.

B.Add a reference to the custom service host in the web.config file.

C.Add code to instantiate the custom service host from within the main procedure of the WCF service.

D.Create a custom service host factory that instantiates the custom service host. Include a reference to this factory in the .svc file.

Answer: D

Question: 57

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted on a Web server. You need to ensure that the service is able to access the current HttpContext instance. Which configuration settings and attribute should you use?

A.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Allowed)]

B.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="false" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Allowed)]

C.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

Page 28 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

</system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.NotAllowed)]

D. <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="false" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Required)]

Answer: A

Question: 58

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be exposed for consumption. You need to ensure that the service supports interoperability with the broadest possible number of Web Service toolkits. The service must also support transport-level security. Which configuration setting should you use?

A.<endpoint address="" binding="basicHttpBinding" contract="IContract"></endpoint>

B.<endpoint address="" binding="wsHttpBinding" contract="IContract"></endpoint>

C.<endpoint address="" binding="wsDualHttpBinding" contract="IContract"></endpoint>

D.<endpoint address="" binding="wsFederationHttpBinding" contract="IContract"></endpoint>

Answer: A

Question: 59

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You find that the service starts even though the endpoints have not been configured correctly. You need to create a custom service behavior that throws an exception if the list of endpoints that are configured is not complete. Which code segment should you use?

A.class CustomBehavior:IServiceBehavior{ public void Validate(ServiceDescription description, ServiceHostBase serviceHostBase) { MyValidationMethod(); //validates list of endpoints. }}

B.class CustomBehavior:IEndpointBehavior{ public void Validate(ServiceEndpoint endpoint) { MyValidationMethod(); //validates list of endpoints. }}

C.class CustomBehavior:IContractBehavior{ public void Validate(ContractDescription contractDescription,

ServiceEndpoint endpoint) { MyValidationMethod(); //validates list of endpoints. }}

D.class CustomBehavior:IOperationBehavior{ public void Validate(OperationDescription operationDescription) { MyValidationMethod(); //validates list of endpoints. }}

Answer: A

Question: 60

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will contain an enumeration named OrderState.

The OrderState enumeration will contain the following four values: Processing

Cancelled

Confirmed Closed

The client application must be able to set the state of an Order entity to only the following two values:

Cancelled Closed

You need to create the data contract for OrderState. Which code segment should you use?

Page 29 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.[DataContract]public enum OrderState{ Processing=1, [DataMember] Cancelled=2, [DataMember]

Confirmed=3, Closed=4}

B.[DataContract]public enum OrderState{ Processing=1, [EnumMember] Cancelled=2, Confirmed=3,

[EnumMember] Closed=4}

C.[DataContract]public enum OrderState{ [EnumMember(Value="False")] Processing=1, [EnumMember(Value="True")] Cancelled=2, [EnumMember(Value="True")] Confirmed=3, [EnumMember(Value="False")] Closed=4}

D.[DataContract]public enum OrderState{ [DataMember] Processing=1, [DataMember(IsRequired=true)]

Cancelled=2, [DataMember] Confirmed=3, [DataMember(IsRequired=true)] Closed=4}

Answer: B

Question: 61

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment. [DataContract]

public class Person

{

...

}

[DataContract]

public class Customer : Person

{

...

}

You need to create a service contract that meets the following requirements:

The service contract must have an operation contract named GetPerson that returns an object of type Person.

The GetPerson operation must be able to return an object of type Customer. Which code segment should you use?

A.[ServiceContract][ServiceKnownType("GetPerson")]public interface IMyService{ [OperationContract]

Person GetPerson();}

B.[ServiceContract]public interface IMyService{ [OperationContract] [ServiceKnownType("Customer")]

Person GetPerson();}

C.[ServiceContract][ServiceKnownType(typeof(Customer))]public interface IMyService{ [OperationContract] Person GetPerson();}

D.[ServiceContract][ServiceKnownType("GetPerson",typeof(Customer))]public interface IMyService{

[OperationContract] Person GetPerson();}

Answer: C

Question: 62

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

You write the following code segment. (Line numbers are included for reference only.)

Page 30 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

01 public interface IMyService

02 {

03

04 string ProcessString(string name);

05 }

You create a host for the WCF service. You also create a service endpoint at http://localhost:8080/service.

You add an instance of the HttpTransferEndPointBehavior class to the host.

You need to ensure that the ProcessString method can be invoked from a Web browser by using the URL

http://localhost:8080/service/process?name=valueWhich code segment should you insert at line 03?

A.[OperationContract(Name="process", Action="Get")]

B.[OperationContract(Name="process", Action="Post")]

C.[OperationContract][WebGet(UriTemplate = "process?name={name}")]

D.[OperationContract][WebInvoke(UriTemplate = "process?name={name}")]

Answer: C

Question: 63

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment. [ServiceContract]

public interface IMathService

{

[OperationContract]

int AddNumbers(int a, int b);

double AddNumbers(double a, double b);

}

You have not deployed the IMathService service.

You need to expose the AddNumbers (double a, double b) operation to the IMathService service contract.

Which code segment should you use?

A.[OperationContract]int AddNumbers(int a, int b);[OperationContract]double AddNumbers(double a, double

b);

B.[OperationContract(Name="AddInt")]int AddNumbers(int a, int b);[OperationContract(Name="AddDouble")]double AddNumbers(double a, double b);

C.[OperationContract(Action="IMathService/AddInt")]int AddNumbers(int a, int b);[OperationContract(Action="IMathService/AddDouble")]double AddNumbers(double a, double b);

D.[OperationContract(Action="AddInt/*")]int AddNumbers(int a, int b);[OperationContract(Action="AddDouble/*")]double AddNumbers(double a, double b);

Answer: B

Question: 64

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to ensure that data sent in a SOAP header is in the following XML format.

Page 31 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

<Data>

<string>String 1</string> <string>String 2</string> <string>String 3</string> </Data>

Which code segment should you use?

A.[MessageContract]public class MyMessage{ [MessageHeader] public string[] Data;}

B.[MessageContract]public class MyMessage{ [MessageHeaderArray] public string[] Data;}

C.[MessageContract]public class MyMessage{ [MessageProperty] public string[] Data;}

D.[MessageContract]public class MyMessage{ [MessageBodyMember (Order=0)] public string[] Data;}

Answer: A

Question: 65

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment. (Line numbers are included for reference only.)

01 [ServiceContract(SessionMode=SessionMode.Required)]

02 public interface IOrderManager

03 {

04

05 void CloseOrder();

06 }

You need to decorate the operation as the method that closes the current session. Which code segment should you insert at line 04?

A.[OperationContract(IsInitiating=false)]

B.[OperationContract(IsTerminating=true)]

C.[OperationContract][OperationBehavior(ReleaseInstanceMode= ReleaseInstanceMode.AfterCall)]

D.[OperationContract(IsTerminating=false)][OperationBehavior(ReleaseInstanceMode= ReleaseInstanceMode.AfterCall)]

Answer: B

Question: 66

You have created a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The existing service interface is named IMyService, and contains the following code segment. [ServiceContract(Name="SvcOrder",

Namespace="http://contoso.com/services")] public interface IMyService

{

[OperationContract] void DoSomething();

}

You create a new service named IMyServiceV1 that contains an operation named DoSomethingElse.

Page 32 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You need to ensure that existing client applications are still able to access the IMyService.DoSomething

method without modifying client code.

Which code segment should you use?

A.[ServiceContract(Namespace="http: //contoso.com/services/V1")]public interface IMyServiceV1 :

IMyService{ [OperationContract] void DoSomethingElse();}

B.[ServiceContract(Name="SvcOrder")]public interface IMyServiceV1 : IMyService{ [OperationContract]

void DoSomethingElse();}

C.[ServiceContract(Name="SvcOrderV1", Namespace="http: //contoso.com/services")]public interface

IMyServiceV1 : IMyService{ [OperationContract] void DoSomethingElse();}

D.[ServiceContract(Name="SvcOrder", Namespace="http: //contoso.com/services")]public interface

IMyServiceV1 : IMyService{ [OperationContract] void DoSomethingElse();}

Answer: D

Question: 67

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You need to enable WCF tracing at runtime by using Windows Management Instrumentation (WMI). Which three tasks should you perform? (Each correct answer presents part of the solution. Choose three.)

A.Use WMI to set the AppDomainInfo trace properties to true.

B.Set the wmiProviderEnabled attribute to true in the configuration file.

C.Set the performanceCounters attribute to ServiceOnly in the configuration file.

D.Set up a message log listener in the configuration file. Set all trace properties to false.

E.Set up a System.ServiceModel trace listener in the configuration file. Set all trace properties to false.

Answer: A, B, E

Question: 68

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. The WCF service accepts service requests from different partner applications. One of the partner applications occasionally receives faults. You need to identify why the service is generating faults. You must accomplish this goal without interrupting the service. What should you do?

A.Run SvcTraceViewer.exe /register on the WCF server.

B.Connect remotely to the WCF service by using a debugger. Place breakpoints in the exception handling code segment.

C.Configure the Service Tracing options in the application configuration file. Analyze the trace results by using the SvcTraceViewer.exe program.

D.Add the following code segment to the application configuration file. <system.diagnostics> <switches>

<add name="WcfFaultTrace" value="Error" /> </ switches></system.diagnostics>

Answer: C

Page 33 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Question: 69

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5. You need to inspect the parameters on the client application.

Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A.Implement the IParameterInspector interface.

B.Implement the IClientMessageInspector interface.

C.Insert a behavior before you call the ClientBase.Open method.

D.Insert a code segment that creates a behavior in the ICallContextInitializer.BeforeInvoke() method.

E.Implement the IEndpointBehavior behavior to add the parameter inspector to the Dispatcher.ClientOperation.ParameterInspectors method.

F.Implement the IEndpointBehavior behavior to add the parameter inspector to the Dispatcher.DispatchOperation.ParameterInspectors method.

Answer: A, C, E

Question: 70

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment to define the service. (Line numbers are included for reference only.)

01

02 public interface IMyService

03 {

04 [OperationContract]

05 void ProcessOrder(int ordered);

06 }

07 public class ServiceImpl : IMyService

08 {

09[OperationBehavior(TransactionAutoComplete=false,

10TransactionScopeRequired=true)]

11public void ProcessOrder(int custId)

12{

13

14 }

15 }

You need to set the ServiceContract attribute for the transaction behavior of the service. Which code segment should you insert at line 01?

A.[ServiceContract(SessionMode=SessionMode.Required)]

B.[ServiceContract(SessionMode=SessionMode.Allowed)]

C.[ServiceContract(SessionMode=SessionMode.Allowed, ProtectionLevel=ProtectionLevel.EncryptAndSign)]

D.[ServiceContract(SessionMode=SessionMode.NotAllowed, ProtectionLevel=ProtectionLevel.EncryptAndSign)]

Answer: A

Question: 71

Page 34 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating a remote database management application by using Microsoft Windows Forms and Microsoft .NET Framework 3.5.

You use the Windows Communication Foundation model to create the application. You write the following code segment. (Line numbers are included for reference only.)

01 public class QueryAnalyzerService :

02 IQueryAnalyzerService, IDisposable {

03

04 public void Open() {

05 }

06 public void ExecuteSql(string sql) {

07 ...

08 }

09 public void Close() {

10 ...

11 }

12 public void Dispose() {

13 ...

14 }

15 ...

16 }

You need to ensure that each time a client application calls the Open() method, a new service instance is created.

Which code segment should you insert at line 03?

A.[OperationBehavior( TransactionScopeRequired=true)]

B.[OperationBehavior( AutoDisposeParameters=true)]

C.[OperationBehavior( ReleaseInstanceMode=ReleaseInstanceMode.None)]

D.[OperationBehavior( ReleaseInstanceMode=ReleaseInstanceMode.BeforeCall)]

Answer: D

Question: 72

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment.

[ServiceContract]

public interface IMathSrvc

{

[OperationContract]

void AddNumbers(int num); [OperationContract]

int Clear();

}

You need to ensure that the service meets the following requirements: The service can call the AddNumbers operation multiple times.

The AddNumbers operation must start a session on the initial call. The service must call the Clear operation only if a session exists.

The service must not call other operations after it calls the Clear operation. Which code segment should you use to replace the existing code segment?

Page 35 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.[ServiceContract]public interface IMathSrvc{ [OperationContract(IsOneWay=true)] void AddNumbers(int num); [OperationContract(IsTerminating=true)] int Clear();}

B.[ServiceContract]public interface IMathSrvc{ [OperationContract(IsTerminating=false)] void AddNumbers(int num); [OperationContract(IsTerminating=true)] int Clear();}

C.[ServiceContract]public interface IMathSrvc{ [OperationContract(IsInitiating=true, IsOneWay=true)]

void AddNumbers(int num); [OperationContract(IsTerminating=true)] int Clear();}

D.[ServiceContract]public interface IMathSrvc{ [OperationContract] void AddNumbers(int num); [OperationContract(IsInitiating=false, IsTerminating=true)] int Clear();}

Answer: D

Question: 73

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment.

01 [ServiceContract]

02 public class MyService

03 {

04 [OperationContract]

05

06 public void MyMethod()

07 {

08

09 }

10 }

The service uses a transactional binding. The TransactionFlow property for the binding is set to true.

You need to ensure that the MyMethod method meets the following requirements: The method uses a client-side transaction if a client-side transaction exists.

The method uses a server-side transaction if a client-side transaction does not exist. Which code segment should you insert at line 05?

A. [OperationBehavior(TransactionScopeRequired=true)][TransactionFlow(TransactionFlowOption.A llowed)]

B. [OperationBehavior(TransactionScopeRequired=true)][TransactionFlow(TransactionFlowOption. Mandatory)]

C. [OperationBehavior(TransactionScopeRequired=false)][TransactionFlow(TransactionFlowOption. Allowed)]

D. [OperationBehavior(TransactionScopeRequired=false)][TransactionFlow(TransactionFlowOption. Mandatory)]

Answer: A

Question: 74

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

Page 36 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

[ServiceContract(CallbackContract=typeof(IMyServiceCallback))] public interface IMyService

{

[OperationContract] void MyMethod();

}

[ServiceContract]

public interface IMyServiceCallback

{

[OperationContract] void CallbackMethod();

}

The implementation of the MyMethod operation must call back the CallbackMethod operation. You need to ensure that the service meets the following requirements:

The CallbackMethod operation is able to call the service. The service instance is thread-safe.

Which service implementation should you use?

A.[ServiceBehavior]public class ServiceImpl : IMyService{ public void MyMethod() { IMyServiceCallback cb= OperationContext.Current.GetCallbackChannel<IMyServiceCallback>(); cb.CallbackMethod(); }}

B.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single)]public class ServiceImpl : IMyService{

public void MyMethod() { IMyServiceCallback cb= OperationContext.Current.GetCallbackChannel<IMyServiceCallback>(); cb.CallbackMethod(); }}

C.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]public class ServiceImpl : IMyService{

public void MyMethod() { IMyServiceCallback cb= OperationContext.Current.GetCallbackChannel<IMyServiceCallback>(); cb.CallbackMethod(); }}

D.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Reentrant)]public class ServiceImpl : IMyService{ public void MyMethod() { IMyServiceCallback cb= OperationContext.Current.GetCallbackChannel<IMyServiceCallback>(); cb.CallbackMethod(); }}

Answer: D

Question: 75

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET framework 3.5.

You write the following code segment for a service contract.

[ServiceContract]

public interface IOrderManager{ [OperationContract]

void ProcessOrder(int ordered);

}

You need to ensure that the WCF service meets the following requirements: The ProcessOrder method uses transactions.

The ProcessOrder method commits automatically if no exception occurs. Which method implementation should you use?

A. [TransactionFlow(TransactionFlowOption.NotAllowed)][OperationBehavior]public void ProcessOrder(int

Page 37 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

orderId){}

B. [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete=true)]public void

ProcessOrder(int orderId){} C.

[TransactionFlow(TransactionFlowOption.Allowed)][OperationBehavior(TransactionScopeRequire d=false,

TransactionAutoComplete=true)]public void ProcessOrder(int orderId){} D.

[TransactionFlow(TransactionFlowOption.Allowed)][OperationBehavior(ReleaseInstanceMode= ReleaseInstanceMode.AfterCall, TransactionScopeRequired=true, TransactionAutoComplete=false)]public

void ProcessOrder(int orderId){}

Answer: B

Page 38 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application
  Developer    
Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Microsoft 70-503(VB)

Question: 1

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted on a Web server.

You add the following code fragment to the .svc file.

<% @ServiceHost Factory="ExamServiceFactory" Service="ExamService" %>

You need to create the instances of the services by using the custom ExamServiceFactory class. Which code segment should you use?

A.Public Class ExamServiceFactory Inherits ServiceHost Protected Overrides Sub ApplyConfiguration()

'Implementation code comes here End SubEnd Class

B.Public Class ExamServiceFactory Inherits ServiceHostBase Protected Overrides Sub ApplyConfiguration() 'Implementation code comes here End SubEnd Class

C.Public Class ExamServiceFactory Inherits ServiceHostFactory Protected Overrides Function CreateServiceHost( _ ByVal serviceType As Type, _ ByVal baseAddresses() As System.Uri) As ServiceHost 'Implementation code comes here End FunctionEnd Class

D.Public Class ExamServiceFactory Inherits ServiceHost Public Sub New(ByVal serviceType As Type, _

ByVal ParamArray baseAddresses As Uri()) MyBase.New(serviceType, baseAddresses) 'Implementation code comes here End SubEnd Class

Answer: C

Question: 2

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to expose two different service endpoints that have the same address. Which configuration setting should you use?

A.<service name="ExamService"> <endpoint address="http:.//localhost:8080/service" binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint address="http: //localhost:8080/service"

binding="wsHttpBinding" contract="IComplexExam"/></service>

B.<service name="ExamService"> <endpoint address="http: //localhost:8080/service" binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint address="http: //localhost:8080/service"

binding="wsDualHttpBinding" contract="IComplexExam"/></service>

C.<service name="ExamService"> <host> <baseAddresses> <add baseAddress="http: //localhost:8080/service"/> </baseAddresses> </host> <endpoint binding="wsHttpBinding" contract="ISimpleExam"/> <endpoint binding="basicHttpBinding" contract="IComplexExam"/></service>

D.<service name="ExamService"> <host> <baseAddresses> <add baseAddress="http: //localhost:8080"/> </baseAddresses> </host> <endpoint address="service" binding="wsHttpBinding"

contract="ISimpleExam"/> <endpoint address="service" binding="basicHttpBinding"

Page 39 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

contract="IComplexExam"/></service>

Answer: A

Question: 3

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service uses the net.tcp transport.

You need to ensure that when the server starts, the service starts and continues to run. What should you do?

A.Host the service in a Windows service.

B.Host the service in a Windows Presentation Foundation application.

C.Host the service under IIS 7.0 by using IIS 6.0 compatibility mode.

D.Host the service under IIS 7.0 by using Windows Activation Services.

Answer: A

Question: 4

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a managed Console application.

You want to add endpoints to the service.

You need to ensure that all endpoints use the same base address. Which code fragment should you use?

A.<ServiceContract()> _Public Interface IMortgageServiceEnd InterfacePublic Class MortgageService

Implements IMortgageServiceEnd ClassDim baseAddress As New Uri( _"http: //localhost:8888/MortgageService")Dim _serviceHost As New ServiceHost( _GetType(MortgageService), New

Uri() {baseAddress})_serviceHost.AddServiceEndpoint( _GetType(IMortgageService), New BasicHttpBinding(), "")_serviceHost.Open()

B.<ServiceContract()> _Public Interface IMortgageServiceEnd InterfacePublic Class MortgageService

Implements IMortgageServiceEnd ClassDim baseAddress As New Uri( _"http: //localhost:8888/MortgageService")Dim _serviceHost As New ServiceHost( _GetType(MortgageService), New

Uri() {})_serviceHost.AddServiceEndpoint( _GetType(IMortgageService), _New BasicHttpBinding(),

baseAddress)_serviceHost.Open()

C.<ServiceContract()> _Public Interface IMortgageServiceEnd InterfacePublic Class MortgageService

Implements IMortgageServiceEnd ClassDim baseAddress As String = _"http: //localhost:8888/MortgageService"Dim _serviceHost As New ServiceHost( _GetType(MortgageService), New

Uri() {})_serviceHost.AddServiceEndpoint( _GetType(IMortgageService), _New BasicHttpBinding(),

baseAddress)_serviceHost.Open()

D.<ServiceContract( _Namespace:="http: //localhost:8888/MortgageService")> _Public Interface IMortgageServiceEnd InterfacePublic Class MortgageService Implements IMortgageServiceEnd ClassDim

_serviceHost As New ServiceHost( _GetType(MortgageService), New Uri() {})_serviceHost.AddServiceEndpoint( _GetType(IMortgageService), _New BasicHttpBinding(), "")_serviceHost.Open()

Page 40 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application
  Developer    
Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer: A

Question: 5

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to host the service in a medium trust environment on a Web server.

Which two bindings should you use? (Each correct answer presents a complete solution. Choose two.)

A.NetMsmqBinding

B.BasicHttpBinding

C.WSDualHttpBinding

D.NetTcpBinding

E.WebHttpBinding

Answer: B, E

Question: 6

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to programmatically add the following endpoint definition to the service. http://localhost:8000/ExamService/service

Which code segment should you use?

A.Dim baseAddress As String = "http: //localhost:8000/ExamService"Dim binding1 As New BasicHttpBinding()Using host As New ServiceHost(GetType(ExamService)) host.AddServiceEndpoint(GetType(IExam), binding1, baseAddress)End Using

B.Dim baseAddress As String = _ "http: //localhost:8000/ExamService/service"Dim binding1 As New

BasicHttpBinding()Using host As New ServiceHost(GetType(ExamService)) host.AddServiceEndpoint(GetType(IExam), binding1, baseAddress)End Using

C.Dim baseAddress As String = "http: //localhost:8000/ExamService"Dim binding1 As New WSHttpBinding()Using host As New ServiceHost(GetType(ExamService)) host.AddServiceEndpoint(GetType(IExam), binding1, baseAddress)End Using

D.Dim baseAddress As String = _"http: //localhost:8000/ExamService/service"Dim binding1 As New

NetTcpBinding()Using host As New ServiceHost(GetType(ExamService)) host.AddServiceEndpoint(GetType(IExam), binding1, baseAddress)End Using

Answer: B

Question: 7

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

You need to host the WCF service on the IIS Web server.

First, you create a new folder for your application files. Next, you use the IIS management tool to create a Web application in the new folder.

Which three actions should you perform next? (Each correct answer presents part of the solution. Choose three.)

A.Create a web.config file that contains the appropriate configuration code. Place this file in the application folder.

Page 41 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.Create a web.config file that contains the appropriate configuration code. Place this file in the same folder as your service contract code.

C.Create a service file that has the .svc extension containing the @service directive information for the service. Move this file to the application folder.

D.Create a service file that has the .svc extension containing the @servicehost directive information for the service. Move this file to the application folder.

E.Create a vti_bin sub-folder within the application folder for your code files. Place the code file that defines and implements the service contract in this folder.

F.Create an App_Code sub-folder within the application folder for your code files. Place the code file that defines and implements the service contract in this folder.

Answer: A, D, F

Question: 8

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code fragment in the service configuration file. (Line numbers are included for reference only.)

01 <system.serviceModel>

02 ...

03 <behaviors>

04 <serviceBehaviors>

05 <behavior name="CalculatorServiceBehavior">

06 <CustomServiceBehavior/>

07 </behavior>

08 </serviceBehaviors>

09 </behaviors>

10

11 </system.serviceModel>

You need to register the custom service behavior in the service configuration file. Which code fragment should you insert at line 10?

A.<behaviorExtensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /></behaviorExtensions>

B.<extensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /></extensions>

C.<behaviorExtensions> <extensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /> </extensions> </behaviorExtensions>

D.<extensions> <behaviorExtensions> <add name="CustomServiceBehavior" type="CustomBehavior.CustomServiceBehaviorSection, CustomBehavior, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=null" /> </behaviorExtensions></extensions>

Answer: D

Question: 9

Page 42 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating an application in Windows Communication Foundation(WCF) by using Microsoft.NET Framework 3.5

You need to ensure that the client application communicates with the service by using a duplex contract. Which five actions should you perform?(To answer,move the five appropriate actions from the list of actions to the answer area,and arrange them in the correct order.)

Answer:

Question: 10

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service will be hosted in a Console application.

You need to configure the service by using a configuration file other than the default app.config file. Which code segment should you use?

A.Class MyServiceHost Inherits ServiceHost Public Sub New(ByVal serviceType As Type, _ ByVal

ParamArray baseAddresses As Uri()) MyBase.New(serviceType, baseAddresses) End Sub Protected

Overrides Sub InitializeRuntime() 'Load configuration here End SubEnd Class

B.Class MyServiceHost Inherits ServiceHost Public Sub New(ByVal serviceType As Type, _ ByVal

Page 43 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

ParamArray baseAddresses As Uri()) MyBase.New(serviceType, baseAddresses) End Sub Protected

Overrides Sub ApplyConfiguration() 'Load configuration here End SubEnd Class

C.Class MyServiceHost Inherits ServiceHost Public Sub New(ByVal serviceType As Type, _ ByVal

ParamArray baseAddresses As Uri()) MyBase.New(serviceType, baseAddresses) End Sub Protected

Shadows Sub InitializeDescription( _ ByVal serviceType As Type, _ ByVal baseAddresses As UriSchemeKeyedCollection) 'Load configuration here End SubEnd Class

D.Class MyServiceHost Inherits ServiceHost Public Sub New(ByVal serviceType As Type, _ ByVal

ParamArray baseAddresses As Uri()) MyBase.New(serviceType, baseAddresses) End Sub Protected

Shadows Sub AddBaseAddresses(ByVal baseAddress As Uri) 'Load configuration here End SubEnd Class

Answer: B

Question: 11

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation to create the application.

You plan to perform the following tasks:

Authenticate the client applications by using Microsoft ASP.NET membership provider. Authorize the client applications by using Microsoft ASP.NET role provider.

You write the following code segment.

<ServiceContract()> _ Public Interface IService <OperationContract()> _

Sub Remove(ByVal id As Integer) End Interface

Public Class Service

Implements IService

Public Sub Remove(ByVal id As Integer) _ Implements IService.Remove

End Sub

End Class

You need to ensure that only those client applications that provide credentials belonging to the AdminGroup role can access the Remove method.

What should you do?

A.Add the following attribute to the Remove method of the Service class. <PrincipalPermission(SecurityAction.Demand, Role:="AdminGroup")> _

B.Add the following attribute to the Remove method of the IService interface. <PrincipalPermission(SecurityAction.Demand, Role:="AdminGroup")> _

C.Add the following attribute to the Service class. <PrincipalPermission(SecurityAction.Demand,_ Name:="Remove", Role:="AdminGroup")> _

D.Add the following attribute to the Service class. <PrincipalPermission(SecurityAction.Demand,_ Name:="IService.Remove", Role:="AdminGroup")> _

Answer: A

Page 44 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Question: 12

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. The service will authenticate the client applications by using Personal Information Cards.

You write the following code segment. (Line numbers are included for reference only.)

01 Public Class CustomServiceAuthorizationManager

02 Inherits ServiceAuthorizationManager

03 Public Overrides Function CheckAccess( _

04 ByVal operationContext As OperationContext) As Boolean

05 Dim action As String = _ operationContext.RequestContext. _ RequestMessage.Headers.Action

06 If action = "http://tempuri.org/IEngine/Update" Then

07 For Each cs As ClaimSet In _ operationContext.ServiceSecurityContext. _ AuthorizationContext.ClaimSets

08

09Next

10Return False

11End If

12Return True

13End Function

14Function IsEmailValid(ByVal email As String) As Boolean

15'e-mail validation is performed here;

16Return True

17End Function

18End Class

You need to ensure that only those client applications that provide a valid e-mail address can execute the

Update method.

Which code segment should you insert at line 08?

A.For Each c As Claim In cs.FindClaims( _"http: //schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", _"PossessProperty") Return IsEmailValid(c.Resource.ToString())Next

B.For Each c As Claim In cs.FindClaims( _"http: //schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", _String.Empty) Return IsEmailValid(c.Resource.ToString())Next

C.For Each c As Claim In cs.FindClaims( _"http: //schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", _Rights.PossessProperty) Return

IsEmailValid(c.Resource.ToString())Next

D.For Each c As Claim In cs.FindClaims( _"http: //schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", _Rights.Identity) Return IsEmailValid(c.Resource.ToString())Next

Answer: C

Question: 13

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation (WCF) to create the application.

The operations provided by the WCF server use the remote resources of other computers. These methods use the credentials provided by the client applications.

Page 45 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You need to ensure that the WCF server can impersonate the client applications to access the remote resources.

Which client application settings should you use?

A.<windows allowedImpersonationLevel="Delegation"/>

B.<windows allowedImpersonationLevel="Impersonation"/>

C.<windows allowedImpersonationLevel="Identification"/>

D.<windows allowedImpersonationLevel="Impersonation" allowNtlm="false"/>

Answer: A

Question: 14

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The client applications are unable to use SSL.

You need to ensure that clients authenticate by using a token provided by a Security Token Service (STS). What should you do?

A.Use a BasicHttpBinding binding with the security mode set to Message.

B.Use a BasicHttpBinding binding with the security mode set to TransportWithMessageCredential.

C.Use a WSFederationHttpBinding binding with the security mode set to Message.

D.Use a WSFederationHttpBinding binding with the security mode set to TransportWithMessageCredential.

Answer: C

Question: 15

You are creating a client application by using Microsoft .NET Framework

3.5. You use Windows Communication Foundation (WCF) to create the application.

The client application uses a Personal Information Card to provide authentication information to the WCF server.

You write the following code fragment. (Line numbers are included for reference only.)

01 <wsFederationHttpBinding>

02 <binding name="requireCardSpace">

03 <security mode="Message">

04 <message >

05

06 </message>

07 </security>

08 </binding>

09 </wsFederationHttpBinding>

You need to ensure that one of the claims in the Personal Information Card contains an e-mail address. Which code fragment should you insert at line 05?

A.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress" isOptional="false"/></claimTypeRequirements><issuer address="http:

//schemas.xmlsoap.org/ws/2005/05/identity/issuer/personal"/>

B.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress"/></claimTypeRequirements><issuer address="http: //schemas.xmlsoap.org/ws/2005/05/identity/issuer/personal"/>

Page 46 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

C.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress"/></claimTypeRequirements><issuer address="http: //schemas.xmlsoap.org/ws/2005/05/identity/issuer/managed"/>

D.<claimTypeRequirements> <add claimType="http: //schemas.xmlsoap.org/ws/2005/05/ identity/claims/emailaddress" isOptional="false"/></claimTypeRequirements><issuer address="http:

//schemas.xmlsoap.org/ws/2005/05/identity/issuer/self"/>

Answer: D

Question: 16

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code fragment for the configuration setting. (Line numbers are included for reference only.)

01 <wsHttpBinding>

02 <binding name="simple">

03

04 </binding>

05 </wsHttpBinding>

You need to ensure that the service uses transport security and allows access to anonymous client applications. Which code fragment should you insert at line 03?

A.<security mode="Transport" > <transport clientCredentialType="Basic" /></security>

B.<security mode="Transport" > <message clientCredentialType="None"/></security>

C.<security mode="Transport" > <message clientCredentialType="Certificate"/></security>

D.<security mode="Transport" > <transport clientCredentialType="None" /></security>

Answer: D

Question: 17

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following binding configuration in the configuration file. (Line numbers are included for reference only.)

01 <wsHttpBinding>

02 <binding name="ssl">

03

4 </binding>

05 </wsHttpBinding>

You need to ensure that the following requirements are met: The service must use transport-level security (SSL via HTTPS).

The service must use message-level security to authenticate client applications by using user name and password. Which configuration setting should you insert at line 03?

A.<security mode="Message"> <message clientCredentialType="UserName"/></security>

B.<security mode="TransportWithMessageCredential"> <message clientCredentialType="UserName"/></security>

C.<security mode="Transport"> <transport clientCredentialType="Windows"/> <message clientCredentialType="UserName"/></security>

Page 47 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

D. <security mode="Message" > <transport clientCredentialType="Windows" /> <message clientCredentialType="UserName" /></security>

Answer: B

Question: 18

You create a client application by using Microsoft .NET Framework 3.5.

The client application uses a Windows Communication Foundation (WCF) service.

You plan to implement inspection handling on the client application and the WCF service. You need to add error handling to the WCF service.

What should you do?

A.Modify the BeforeSendReply method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

B.Modify the BeforeSendRequest method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

C.Modify the AfterReceiveRequest method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

D.Modify the AfterReceiveReply method to catch the ReplyValidationFault exception. Replace the reply message with an explicit fault message.

Answer: A

Question: 19

You create a service by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation to create the service.

You use the WSHttpBinding binding to prevent tampering of the data. Users report that the data is unreadable.

You need to troubleshoot the problem by logging the incoming messages. Which code fragment should you use?

A.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtTransportLevel="true"/> </diagnostics></system.serviceModel>

B.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true"/> </diagnostics></system.serviceModel>

C.<system.serviceModel> <diagnostics> <messageLogging logEntireMessage="true" logMalformedMessages="true"/> </diagnostics></system.serviceModel>

D.<system.serviceModel> <diagnostics> <messageLogging logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/> </diagnostics></system.serviceModel>

Answer: B

Question: 20

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

Client applications that run on different platforms access the WCF service. These applications transmit confidential data to the WCF service.

You write the following binding configuration

....

<binding name="TransportSecurity" > <security mode="Transport" /> </binding>

...

You need to configure the service for optimum interoperability and optimum security.

Page 48 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Which code fragment should you use?

A.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="wsHttpBinding" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="http: //localhost:80/Service/"/> </baseAddresses> </host></service>

B.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="basicHttpBinding" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="http: //localhost:80/Service/"/> </baseAddresses> </host></service>

C.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="https: //localhost:443/Service/"/> </baseAddresses> </host></service>

D.<service name="AdventureWorks.Travel.ReservationService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="AdventureWorks.Travel.IReservationService"/> <host> <baseAddresses> <add baseAddress="https: //localhost:443/Service/"/> </baseAddresses> </host></service>

Answer: C

Question: 21

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You set up tracing for the service. The tracing fails because of an error in the service configuration.

You need to identify the cause of the error. What should you do?

A.Examine the system event log.

B.Examine the security event log.

C.Examine the application event log.

D.Set the enableLogKnownPii attribute to true in the machine.config file.

Answer: C

Question: 22

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You want to enable message logging.

You add the following code fragment to the service configuration file.

<system.diagnostics> <sources>

<source name="System.ServiceModel.MessageLogging"> <listeners>

<add name="messages" type="System.Diagnostics.XmlWriterTraceListener" /> </listeners>

</source> </sources> </system.diagnostics>

You receive an exception.

You need to successfully enable message logging.

Page 49 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

What should you do?

A.Remove the message filter.

B.Set the switchValue attribute to verbose.

C.Set the initializeData attribute to the name of a log file.

D.Set the maximum size of the message to be logged to 256K.

Answer: C

Question: 23

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

You configure a binding to enable streaming.

You need to ensure that the client application is able to stream large XML files to the WCF service. Which operation contract should you create?

A.<OperationContract()> _ Sub UploadFile(ByVal xmlData As Stream)

B.<OperationContract()> _ Sub UploadFile(ByVal xmlData As XmlWriter)

C.<OperationContract()> _ Sub UploadFile(ByVal xmlData As StreamWriter)

D.<OperationContract()> _ Sub UploadFile(ByVal xmlData As Byte())

Answer: A

Question: 24

You create a Windows Communication Foundation client application by using Microsoft .NET Framework 3.5.

The client application communicates with an existing Web service that requires custom HTTP headers.

You need to ensure that all messages sent to the service include the headers.

Which two tasks should you perform? (Each correct answer presents part of the solution. Choose two.)

A.Create a message inspector. Insert the custom headers by using the IClientMessageInspector.AfterReceiveReply method.

B.Create a message inspector. Insert the custom headers by using the IClientMessageInspector.BeforeSendRequest method.

C.Create a custom endpoint behavior. Add the message inspector by using the IEndpointBehavior.ApplyClientBehavior method.

D.Create a custom endpoint behavior. Add the message inspector by using the IEndpointBehavior.AddBindingParameters method.

Answer: B, C

Question: 25

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment. (Line numbers are included for reference only.)

01 <ServiceContract(Namespace:="http://uri.contoso.com")> _

02 Public Interface IMyService

03 <OperationBehavior()> _

04 Function ProcessDetails(ByVal s As String) As String

05 <OperationContract(Action:="UpdateStatus")> _

06 Sub UpdateStatus()

Page 50 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

07

08 End Interface

If the existing operation contract is unable to process a request made to the service, a generic operation contract must attempt to process the request.

You need to create the generic operation contract. Which code segment should you insert at line 07?

A.<OperationContract(Action:="*")> _ Sub ProcessOthers(ByVal msg As Message)

B.<OperationContract(Action:="*")> _ Sub ProcessOthers()

C.<OperationContract(Action:="Default")> _ Sub ProcessOthers(ByVal msg As Message)

D.<OperationContract(Action:="Default")> _ Sub ProcessOthers()

Answer: A

Question: 26

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The WCF service contains two operations named ProcessSimpleOrder and ProcessComplexOrder.

You need to expose the ProcessSimpleOrder operation to all the client applications. You also need to expose the ProcessComplexOrder operation only to specific client applications. Which code segment should you use?

A.<ServiceContract()> _ Public Interface IOrderManager <OperationContract(Action:="*")> _ Sub ProcessSimpleOrder() <OperationContract()> _ Sub ProcessComplexOrder()End Interface

B.<ServiceContract()> _ Public Interface IOrderManager <OperationContract(Name:="http: //contoso.com/Simple")> _ Sub ProcessSimpleOrder() <OperationContract(Name:="http: //contoso.com/Complex")> _ Sub ProcessComplexOrder()End Interface

C.<ServiceContract()> _ Public Interface ISimpleOrderManager <OperationContract()> _ Sub ProcessSimpleOrder()End Interface<ServiceContract()> _ Public Interface IComplexOrderManager Inherits

ISimpleOrderManager <OperationContract()> _ Sub ProcessComplexOrder()End Interface

D.<ServiceContract()> _ Public Interface ISimpleOrderManager <OperationContract(Name:="http:

//contoso.com/Simple")> _ Sub ProcessSimpleOrder()End InterfacePublic Interface IComplexOrderManager

Inherits ISimpleOrderManager <OperationContract(Name:="http: //contoso.com/Complex")> _ Sub ProcessComplexOrder()End Interface

Answer: C

Question: 27

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment. <ServiceContract()> _

Public Interface IMyService <OperationContract(IsOneWay:=True, _ ProtectionLevel:=ProtectionLevel.None)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _ Sub DoSomething()

End Interface

You need to ensure that the DoSomething operation can participate in transactions.

Page 51 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Which code segment should you use to replace the existing operation contract?

A.<OperationContract( _ ProtectionLevel:=ProtectionLevel.None)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _ Sub DoSomething()

B.<OperationContract( _ ProtectionLevel:=ProtectionLevel.EncryptAndSign)> _ <TransactionFlow(TransactionFlowOption.NotAllowed)> _ Sub DoSomething()

C.<OperationContract(IsOneWay:=True, _ ProtectionLevel:=ProtectionLevel.EncryptAndSign)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _ Sub DoSomething()

D.<OperationContract(IsOneWay:=True, _ ProtectionLevel:=ProtectionLevel.Sign)> _ <TransactionFlow(TransactionFlowOption.Mandatory)> _ Sub DoSomething()

Answer: A

Question: 28

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You have successfully defined a service contract named IManageOrders.

You write the following code segment. Public Class OrderImpl

Implements IManageOrders

Public Sub MarkOrderClosed(ByVal orderId As Integer) _ Implements IManageOrders.MarkOrderClosed

Try

...

Catch ex As SqlException

Throw New FaultException(Of DataFault)( _ New DataFault())

End Try

End Sub

End Class <DataContract()> _ Public Class DataFault End Class

You need to create a fault contract for the MarkOrderClosed method on the IManageOrders service

contract.

Which code segment should you add?

A.<FaultContract(GetType(DataFault))>

B.<FaultContract(GetType(Exception))>

C.<FaultContract(GetType(SqlException))>

D.<FaultContract(GetType(FaultException))>

Answer: A

Question: 29

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment for the service implementation. (Line numbers are included for reference only.)

01 Public Sub PutMessage(ByVal msg As Message)

02 Dim value As String = Nothing

03

Page 52 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

04 End Sub

You need to retrieve the content from the received message body and store it in the variable named value.

Which code segment should you insert at line 03?

A.value = msg.GetBody(Of String)()

B.Dim ns As String = msg.Headers.GetHeader(Of String)(0)value = msg.GetBodyAttribute("Body", ns)

C.Dim reader As XmlReaderreader = msg.GetBody(Of XmlReader)()value = reader.ReadOuterXml()

D.Dim reader As XmlReaderreader = msg.GetReaderAtBodyContents()value = reader.ReadOuterXml()

Answer: D

Question: 30

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to ensure that the service can send data in the following format to the client applications.

<Account Id=""> <Name> </Name>

<Balance Currency=""> </Balance> </Account>

Which code segment should you use?

A.<Serializable()> _ Public Class Account <XmlAttribute()> _ Public Id As String <XmlElement()>_

Public Name As String <XmlAttribute()> _ Public Currency As String <XmlElement()> _ Public Balance

As DoubleEnd Class

B.<DataContract()> _ Public Class Account <DataMember(Order:=0)> _ Public Id As String <DataMember(Order:=1)> _ Public Name As String <DataMember(Order:=0)> _ Public Balance As Double

<DataMember(Order:=1)> _ Public Currency As StringEnd Class

C.<Serializable()> _ Public Class Account <XmlAttribute()> _ Public Id As String Public Name As String

<XmlElement("Balance")> _ Public Balance As BalanceValEnd Class<Serializable()> _ Public Class

BalanceVal <XmlText()> _ Public Amount As Double <XmlAttribute()> _ Public Currency As StringEnd

Class

D.<DataContract()> _ Public Class Account <DataMember(Order:=0)> _ Public Id As String <DataMember(Order:=1)> _ Public Name As String <DataMember(Name:="Balance", Order:=2)> _ Public

Balance As BalanceValEnd Class<DataContract()> _ Public Structure BalanceVal <DataMember(Order:=0)>

_ Public Amount As Double <DataMember(Order:=1)> _ Public Currency As StringEnd Structure

Answer: C

Page 53 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Question: 31

You are creating a client application that will call a Windows Communication Foundation service. The service was created by using Microsoft .NET Framework 3.5.

You write the following code segment.

<DataContract()> _ Public Class CreditCard <DataMember()> _

Public Property Name() As String Get

End Get

Set(ByVal value As String) End Set

End Property <DataMember()> _

Public Property CardNumber() As String Get

Return _cardNumber End Get

Set(ByVal value As String)

If Not IsValidCreditCardNumber(value) Then

Throw New ArgumentException("Invalid credit card number") Else

_cardNumber = value End If

End Set End Property End Class

You plan to share the validation logic between the client application and the WCF service. You need to generate a client-side service proxy that includes the validation logic.

Which four tasks should you perform? (Each correct answer presents part of the solution. Choose four.)

A.Create a Class Library project for the DataContract classes.

B.In the Service project, add a reference to the Class Library project.

C.In the Client project, add a reference to the Class Library project.

D.In the Client project, use the Add Web Reference dialog box to reference the service.

E.In the Client project, use the Add Service Reference dialog box to reference the service.

F.In the Client project, use the Add Reference dialog box to add a project reference to the Service project.

Answer: A, B, C, E

Question: 32

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5.

You add the following code segment to a service contract.

<ServiceContract()> _ Interface IDocumentService <OperationContract()> _

Function DeleteDocument(ByVal id As Integer) As Integer End Interface

Page 54 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

The DeleteDocument method in the service contract takes a long time to execute. The client application stops responding until the method finishes execution.

You write the following code segment to create an instance of a service proxy in the client application.

(Line numbers are included for reference only.)

01 Shared Sub Main()

02 Dim client As New DocumentServiceClient()

03

04 End Sub

05 Shared Sub ProcessDeleteDocument(ByVal result As IAsyncResult)

06

07 End Sub

You need to ensure that the service methods are called asynchronously.

What should you do?

A.Insert the following code segment at line 03. client.BeginDeleteDocument(20, _AddressOf ProcessDeleteDocument, client) Insert the following code segment at line 06. Dim count As Integer =

_CType(result.AsyncState, DocumentServiceClient). _EndDeleteDocument(Nothing)

B.Insert the following code segment at line 03. client.BeginDeleteDocument(20, _AddressOf ProcessDeleteDocument, client) Insert the following code segment at line 06. result.AsyncWaitHandle.WaitOne()Dim count As Integer = _CType(result, DocumentServiceClient).

_EndDeleteDocument(result)

C.Insert the following code segment at line 03. client.BeginDeleteDocument(20, _AddressOf ProcessDeleteDocument, client) Insert the following code segment at line 06. Dim count As Integer =

_CType(result.AsyncState, DocumentServiceClient). _EndDeleteDocument(result)

D.Insert the following code segment at line 03. Dim result As IAsyncResult = _client.BeginDeleteDocument(20, _AddressOf ProcessDeleteDocument, client)Dim count As Integer =

_client.EndDeleteDocument(result) Insert the following code segment at line 06. result.AsyncWaitHandle.WaitOne()

Answer: C

Question: 33

You are creating a Windows Communication Foundation application by using Microsoft .NET Framework 3.5.

The application must consume an ATOM 1.0 feed published at http://localhost:8000/BlogService/GetBlog.

You write the following code segment. (Line numbers are included for reference only.)

01 Dim address As New Uri( _ "http://localhost:8000/BlogService/GetBlog") 02

03 Console.WriteLine(feed.Title.Text)

You need to ensure that the application prints the title of the feed.

Which code segment should you insert at the line 02?

Page 55 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.Dim feed As SyndicationFeed = SyndicationFeed.Load(address)

B.Dim feed As SyndicationFeed = New SyndicationFeed()feed.BaseUri = address

C.Dim item As SyndicationItem = SyndicationItem.Load(address)Dim feed As New SyndicationFeed()feed.Items = New SyndicationItem() {item}

D.Dim item As New SyndicationItem()item.BaseUri = addressDim feed As New SyndicationFeed()feed.Items = New SyndicationItem() {item}

Answer: A

Question: 34

You are creating a client application by using Microsoft .NET Framework 3.5. The client application uses a Windows Communication Foundation service.

To log the called service proxy methods and their parameters, you implement custom endpoint behavior in the following class.

Class ParametersLoggerBehavior Implements IEndpointBehavior End Class

You also create the following class for the custom behavior. Class LoggerElement

Inherits BehaviorExtensionElement End Class

You add the following configuration code fragment to the application configuration file. (Line numbers are included for reference only.)

01 <behaviors>

02 <endpointBehaviors>

03

04 </endpointBehaviors>

05 </behaviors>

06 <extensions>

07 <behaviorExtensions>

08 <add name="debugBehavior" type="Client.LoggerElement,

09 ClientApp, Version=1.0.0.0, Culture=neutral,

10 PublicKeyToken=null"/>

11 </behaviorExtensions>

12 </extensions>

You need to ensure that the endpoint uses the custom behavior.

Which configuration settings should you insert at line 03?

A.<debugBehavior name="debug" />

B.<behavior name="debug"> <debugBehavior /></behavior>

C.<behavior name="debug"> <ParametersLoggerBehavior /></behavior>

D.<ParametersLoggerBehavior name="debug"> <debugBehavior /></ParametersLoggerBehavior>

Answer: B

Question: 35

You are creating a Windows Communication Foundation (WCF) client application by using Microsoft .NET Framework 3.5.

The WCF service transfers data to the client applications by using the streaming transfer mode. You need to create an endpoint that supports the streaming transfer mode.

Which binding should you use?

Page 56 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.wsHttpBinding

B.basicHttpBinding

C.webHttpBinding

D.wsFederationHttpBinding

Answer: B

Question: 36

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

You add the following code segment to the service.

<ServiceContract()> _

Public Interface ICalulatorService <OperationBehavior()> _ <FaultContract(GetType(ArithmeticException))> _ Function Divide(ByVal number1 As Double, _ ByVal number2 As Double) As Double <OperationContract()> _

Sub DisposeCalculator() End Interface

<ServiceBehavior(IncludeExceptionDetailInFaults:=True)> _ Public Class CalculatorService

Implements ICalulatorService

Public Function Divide(ByVal number1 As Double, _ ByVal number2 As Double) _

As Double Implements ICalulatorService.Divide If number2 = 0 Then

Throw New DivideByZeroException End If

Return number1 / number2 End Function

Public Sub DisposeCalculator() _

Implements ICalulatorService.DisposeCalculator 'Release resource

'...

End Sub

End Class

You add the following code segment to the client application.

01 Public Function PerformCalculations(ByVal number1 As Double, _ ByVal number2 As Double) As Double

02

03 End Function

You need to ensure that the DisposeCalculator operation is always called. Which code segment should you insert at line 02?

A.Dim proxy As New CalculatorClientDim result As Integer = -1Try result = proxy.Divide(number1,

number2)Catch ex As DivideByZeroExceptionEnd Tryproxy.DisposeCalculator()Return result

B.Dim proxy As New CalculatorClientDim result As Integer = -1Try result = proxy.Divide(number1,

number2)Catch ex As DivideByZeroException proxy.Close() proxy = New CalculatorClient()End Tryproxy.DisposeCalculator()Return result

Page 57 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

C.Dim proxy As New CalculatorClientDim result As Integer = -1Try result = proxy.Divide(number1,

number2)Catch ex As FaultExceptionEnd Tryproxy.DisposeCalculator()Return result

D.Dim proxy As New CalculatorClientDim result As Integer = -1Try result = proxy.Divide(number1,

number2)Catch ex As FaultException proxy.Close() proxy = New CalculatorClient()End Tryproxy.DisposeCalculator()Return result

Answer: D

Question: 37

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5.

The client application consumes the Web Services Enhancements (WSE) 3.0 Web service. The Web service uses standard WSE 3.0 to transfer binary data to the client application.

The client application uses the following binding configuration. (Line numbers are included for reference only.)

01 <customBinding>

02 <binding name="custom" >

03

04 <httpTransport maxBufferSize="700000" 04 maxReceivedMessageSize="700000" />

05 </binding>

06 </customBinding>

You need to ensure that the client application receives binary data from the WSE 3.0 Web service. Which code fragment should you insert at line 03?

A.<binaryMessageEncoding maxReadPoolSize="700000" />

B.<binaryMessageEncoding > <readerQuotas maxBytesPerRead="700000" /></binaryMessageEncoding>

C.<binaryMessageEncoding > <readerQuotas maxArrayLength="700000"/></binaryMessageEncoding>

D.<mtomMessageEncoding messageVersion="Soap12WSAddressingAugust2004"> <readerQuotas

maxArrayLength="700000"/></mtomMessageEncoding>

Answer: D

Question: 38

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You create the following service contract. <ServiceContract()> _

Public Interface IMyService <OperationContract()> _ Sub DoSomething()

End Interface

The service will not use any external resources.

You need to ensure that the calls to the DoSomething operation are thread-safe.

What are the two possible service implementations that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Page 58 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

A.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, _ InstanceContextMode:=InstanceContextMode.Single)> _ Public Class ServiceImpl Implements IMyService

Public Sub DoSomething() _ Implements IMyService.DoSomething End SubEnd Class

B.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Single, _ InstanceContextMode:=InstanceContextMode.Single)> _ Public Class ServiceImpl Implements IMyService

Public Sub DoSomething() _ mplements IMyService.DoSomething End SubEnd Class

C.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, _ InstanceContextMode:=InstanceContextMode.PerSession)> _ Public Class ServiceImpl Implements

IMyService Public Sub DoSomething() _ Implements IMyService.DoSomething End SubEnd Class

D.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, _ InstanceContextMode:=InstanceContextMode.PerCall)> _ Public Class ServiceImplD Implements IMyService

Public Sub DoSomething() _ Implements IMyService.DoSomething End SubEnd Class

Answer: B, D

Question: 39

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

01 <ServiceContract()> _

02 Public Interface IMyService

03 <OperationContract()> _

04 Sub MyMethod()

05 End Interface

06 Public Class ServiceImpl

07 Implements IMyService

08

09 Public Sub MyMethod() Implements IMyService.MyMethod

10 End Sub

11 End Class

You need to ensure that when the MyMethod method is called, the service is the root of a transaction. Which code segment should you insert at line 08?

A.<OperationBehavior(TransactionScopeRequired:=True)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _

B.<OperationBehavior(TransactionScopeRequired:=True)> _ <TransactionFlow(TransactionFlowOption.NotAllowed)> _

C.<OperationBehavior(TransactionScopeRequired:=False)> _ <TransactionFlow(TransactionFlowOption.Mandatory)> _

D.<OperationBehavior(TransactionScopeRequired:=False)> _ <TransactionFlow(TransactionFlowOption.NotAllowed)> _

Answer: D

Question: 40

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You create the following service definition.

Page 59 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

<ServiceContract()> _ Public Interface IMyService

...

End Interface

You need to custom manage the lifetime of the session. Which service implementation should you use?

A.<ServiceBehavior(AutomaticSessionShutdown:=True)> _ Public Class ServiceImpl ...End Class

B.<ServiceBehavior(AutomaticSessionShutdown:=False)> _ Public Class ServiceImpl ...End Class

C.<ServiceBehavior(UseSynchronizationContext:=True)> _ Public Class ServiceImpl ...End Class

D.<ServiceBehavior(UseSynchronizationContext:=False)> _ Public Class ServiceImplD ...End Class

Answer: D

Question: 41

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment for the service contract. (Line numbers are included for reference only.)

01 <ServiceContract()> _

02

03 Public Class MyService

04 ...

05 End Class

The service uses transactions that time out in a minute.

You need to increase the timeout interval of the transactions to 2 minutes and 30 seconds. Which code segment should you insert at line 02?

A.<ServiceBehavior(TransactionTimeout:="150")> _

B.<ServiceBehavior(TransactionTimeout:="0:2:30")> _

C.<ServiceBehavior(TransactionTimeout:="2:30:00")> _

D.<ServiceBehavior(TransactionTimeout:="0:150:00")> _

Answer: B

Question: 42

You create a stateless, thread-safe service by using Microsoft .NET Framework 3.5. You use the Windows Communication Foundation model to create the service.

Load testing reveals that the service does not scale above 1,000 concurrent users.

You discover that each call to the service instantiates a new service instance. You also discover that these service instances are expensive to create.

You need to ensure that 5,000 concurrent users can access the service. Which code segment should you use?

A.<ServiceBehavior( _InstanceContextMode:=InstanceContextMode.PerCall, _ConcurrencyMode:=ConcurrencyMode.Reentrant)> _

B.<ServiceBehavior( _InstanceContextMode:=InstanceContextMode.Single, _ConcurrencyMode:=ConcurrencyMode.Multiple)> _

Page 60 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

C.<ServiceBehavior( _InstanceContextMode:=InstanceContextMode.PerCall, _ConcurrencyMode:=ConcurrencyMode.Multiple)> _

D.<ServiceBehavior( _InstanceContextMode:=InstanceContextMode.Single, _ConcurrencyMode:=ConcurrencyMode.Reentrant)> _

Answer: B

Question: 43

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

01 <ServiceContract()> _

02 Public Interface IMyService

03 <OperationContract()> _

04 Sub MyMethod()

05 End Interface

06

07 Public Class ServiceImpl

08 Implements IMyService

09 <OperationBehavior(TransactionScopeRequired:=True)> _

10 Public Sub MyMethod() _

11 Implements IMyService.MyMethod

12

13 End Sub

14 End Class

You need to ensure that concurrent calls are allowed on the service instance. Which code segment should you insert at line 06?

A.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, _ ReleaseServiceInstanceOnTransactionComplete:=True)> _

B.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple, _ ReleaseServiceInstanceOnTransactionComplete:=False)> _

C.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Reentrant, _ ReleaseServiceInstanceOnTransactionComplete:=True)> _

D.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Reentrant, _ ReleaseServiceInstanceOnTransactionComplete:=False)> _

Answer: B

Question: 44

You have created a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The existing service interface is named IMyService, and contains the following code segment. <ServiceContract(Name:="SvcOrder", _

Namespace:="http: //contoso.com/services")> _ Public Interface IMyService <OperationContract()> _

Sub DoSomething() End Interface

You create a new service named IMyServiceV1 that contains an operation named DoSomethingElse.

You need to ensure that existing client applications are still able to access the IMyService.DoSomething

Page 61 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

method without modifying client code. Which code segment should you use?

A.<ServiceContract(Namespace:="http: //contoso.com/services/V1")> _ Public Interface IMyServiceV1

Inherits IMyService <OperationContract()> _ Sub DoSomethingElse()End Interface

B.<ServiceContract(Name:="SvcOrder")> _ Public Interface IMyServiceV1 Inherits IMyService <OperationContract()> _ Sub DoSomethingElse()End Interface

C.<ServiceContract(Name:="SvcOrderV1", _ Namespace:="http: //contoso.com/services")> _ Public

Interface IMyServiceV1 Inherits IMyService <OperationContract()> _ Sub DoSomethingElse()End Interface

D.<ServiceContract(Name:="SvcOrder", _ Namespace:="http: //contoso.com/services")> _ Public Interface

IMyServiceV1 Inherits IMyService <OperationContract()> _ Sub DoSomethingElse()End Interface

Answer: D

Question: 45

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

<ServiceContract()> _ Public Interface IMathService <OperationContract()> _ Function AddNumbers( _

ByVal a As Integer, ByVal b As Integer) As Integer Function AddNumbers( _

ByVal a As Double, ByVal b As Double) As Double End Interface

You have not deployed the IMathService service.

You need to expose the AddNumbers (a As Double, b As Double) As Double operation to the IMathService service contract.

Which code segment should you use?

A.<OperationContract()> _ Function AddNumbers( _ ByVal a As Integer, ByVal b As Integer) As Integer<OperationContract()> _ Function AddNumbers( _ ByVal a As Double, ByVal b As Double) As Double

B.<OperationContract(Name:="AddInt")> _ Function AddNumbers( _ ByVal a As Integer, ByVal b

As

Integer) As Integer<OperationContract(Name:="AddDouble")> _ Function AddNumbers( _ ByVal a As

Double, ByVal b As Double) As Double

C.<OperationContract(Action:="IMathService/AddInt")> _ Function AddNumbers( _ ByVal a As Integer,

ByVal b As Integer) As Integer<OperationContract(Action:="IMathService/AddDouble")> _ Function

AddNumbers( _ ByVal a As Double, ByVal b As Double) As Double

D.<OperationContract(Action:="AddInt/*")> _ Function AddNumbers( _ ByVal a As Integer, ByVal b As

Integer) As Integer<OperationContract(Action:="AddDouble/*")> _ Function AddNumbers( _ ByVal a As

Double, ByVal b As Double) As Double

Page 62 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer: B

Question: 46

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You write the following code segment. (Line numbers are included for reference only.)

01 Public Interface IMyService

02

03 Function ProcessString(ByVal name As String) As String 04 End Interface You create a host for the WCF service.

You also create a service endpoint at http: //localhost:8080/service. You add an instance of the HttpTransferEndPointBehavior class to the host.

You need to ensure that the ProcessString method can be invoked from a Web browser by using the URL

http: //localhost:8080/service/process? name=value

Which code segment should you insert at line 02?

A.<OperationContract(Name:="process", Action:="Get")> _

B.<OperationContract(Name:="process", Action:="Post")> _

C.<OperationContract()> _ <HttpTransferContract(Path:="process", Method:="Get")> _

D.<OperationContract()> _ <HttpTransferContract(Path:="process", Method:="Post")> _

Answer: C

Question: 47

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment. <DataContract()> _

Public Class Person

...

End Class <DataContract()> _ Public Class Customer Inherits Person

...

End Class

You need to create a service contract that meets the following requirements:

The service contract must have an operation contract named GetPerson that returns an object of type Person.

The GetPerson operation must be able to return an object of type Customer. Which code segment should you use?

A.<ServiceContract()> _ <ServiceKnownType("GetPerson")> _ Public Interface IMyService <OperationContract()> _ Function GetPerson() As PersonEnd Interface

B.<ServiceContract()> _ Public Interface IMyService <OperationContract()> _ <ServiceKnownType("Customer")> _ Function GetPerson() As PersonEnd Interface

C.<ServiceContract()> _ <ServiceKnownType(GetType(Customer))> _ Public Interface IMyService

<OperationContract()> _ Function GetPerson() As PersonEnd Interface

Page 63 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

D. <ServiceContract()> _ <ServiceKnownType("GetPerson", GetType(Customer))> _ Public

Interface

IMyService <OperationContract()> _ Function GetPerson() As PersonEnd Interface

Answer: C

Question: 48

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment. (Line numbers are included for reference only.)

01 <ServiceContract(SessionMode:=SessionMode.Required)> _

02 Public Interface IOrderManager

03

04 Sub CloseOrder()

05 End Interface

You need to decorate the operation as the method that closes the current session. Which code segment should you insert at line 03?

A.<OperationContract(IsInitiating:=False)> _

B.<OperationContract(IsTerminating:=True)> _

C.<OperationContract()> _ <OperationBehavior( _ ReleaseInstanceMode:=ReleaseInstanceMode.AfterCall)>_

D.<OperationContract(IsTerminating:=False)> _ <OperationBehavior( _ ReleaseInstanceMode:=ReleaseInstanceMode.AfterCall)> _

Answer: B

Question: 49

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will contain an enumeration named OrderState.

The OrderState enumeration will contain the following four values: Processing

Cancelled

Confirmed Closed

The client application must be able to set the state of an Order entity to only the following two values:

Cancelled Closed

You need to create the data contract for OrderState. Which code segment should you use?

A.<DataContract()> _ Public Enum OrderState Processing = 1 <DataMember()> _ Cancelled = 2 <DataMember()> _ Confirmed = 3 Closed = 4End Enum

B.<DataContract()> _ Public Enum OrderState Processing = 1 <EnumMember()> _ Cancelled =

2

Confirmed = 3 <EnumMember()> _ Closed = 4End Enum

C.<DataContract()> _ Public Enum OrderState <EnumMember(Value:="False")> _ Processing =

1

<EnumMember(Value:="True")> _ Cancelled = 2 <EnumMember(Value:="True")> _ Confirmed = 3

<EnumMember(Value:="False")> _ Closed = 4End Enum

D.<DataContract()> _ Public Enum OrderState <DataMember()> _ Processing = 1

Page 64 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

<DataMember(IsRequired:=True)> _ Cancelled = 2 <DataMember()> _ Confirmed = 3 <DataMember(IsRequired:=True)> _ Closed = 4End Enum

Answer: B

Question: 50

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You need to ensure that data sent in a SOAP header is in the following XML format. <Data>

<string>String 1</string> <string>String 2</string> <string>String 3</string> </Data>

Which code segment should you use?

A.<MessageContract()> _ Public Class MyMessage <MessageHeader()> _ Public Data() As StringEnd

Class

B.<MessageContract()> _ Public Class MyMessage <MessageHeaderArray()> _ Public Data()

As

StringEnd Class

C.<MessageContract()> _ Public Class MyMessage <MessageProperty()> _ Public Data() As StringEnd

Class

D.<MessageContract()> _ Public Class MyMessage <MessageBodyMember(Order:=0)> _ Public Data() As

StringEnd Class

Answer: A

Question: 51

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You need to enable WCF tracing at runtime by using Windows Management Instrumentation (WMI). Which three tasks should you perform? (Each correct answer presents part of the solution. Choose three.)

A.Use WMI to set the AppDomainInfo trace properties to true.

B.Set the wmiProviderEnabled attribute to true in the configuration file.

C.Set the performanceCounters attribute to ServiceOnly in the configuration file.

D.Set up a message log listener in the configuration file. Set all trace properties to false.

E.Set up a System.ServiceModel trace listener in the configuration file. Set all trace properties to false.

Answer: A, B, E

Question: 52

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. The WCF service accepts service requests from different partner applications. One of the partner applications occasionally receives faults. You need to identify why the service is generating faults. You must accomplish this goal without interrupting the service. What should you do?

A. Run SvcTraceViewer.exe /register on the WCF server.

Page 65 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.Connect remotely to the WCF service by using a debugger. Place breakpoints in the exception handling code segment.

C.Configure the Service Tracing options in the application configuration file. Analyze the trace results by using the SvcTraceViewer.exe program.

D.Add the following code segment to the application configuration file. <system.diagnostics> <switches>

<add name="WcfFaultTrace" value="Error" /> </ switches></system.diagnostics>

Answer: C

Question: 53

You are creating a Windows Communication Foundation client application by using Microsoft

.NET Framework 3.5. You need to inspect the parameters on the client application.

Which three actions should you perform? (Each correct answer presents part of the solution. Choose three.)

A.Implement the IParameterInspector interface.

B.Implement the IClientMessageInspector interface.

C.Insert a behavior before you call the ClientBase.Open method.

D.Insert a code segment that creates a behavior in the ICallContextInitializer.BeforeInvoke() method.

E.Implement the IEndpointBehavior behavior to add the parameter inspector to the Dispatcher.ClientOperation.ParameterInspectors method.

F.Implement the IEndpointBehavior behavior to add the parameter inspector to the Dispatcher.DispatchOperation.ParameterInspectors method.

Answer: A, C, E

Question: 54

You create a Windows Communication Foundation (WCF) application by using Microsoft .NET Framework 3.5. The desktop client calls the WCF service to query its status. The call can take up to 10 seconds to complete. The client application must remain responsive when querying the service. You need to generate the required proxy. What should you do?

A.Execute the svcutil http: //localhost:8000/MyWCF /async command.

B.Execute the svcutil myServiceHost.exe /serviceName:MyWCF command.

C.Execute the svcutil /validate /serviceName:MyWCF myServiceHost.exe command.

D.Clear the Generate asynchronous operation check box in the Add Service Reference Settings dialog box.

Answer: A

Question: 55

You are creating a Windows Communication Foundation (WCF) client application by using Microsoft .NET Framework 3.5.

The proxy generated for the WCF service results in the following code segment. <ServiceContract(CallbackContract:=GetType(IStoreCallback))> _

Public Interface IStore <OperationContract(IsOneWay:=True)> _ Sub CheckAvailableProducts()

End Interface

Public Interface IStoreCallback End Interface

To implement a callback interface, you create the following class in the client application.

Page 66 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Public Class StoreCallback

Implements IStoreCallback End Class

The client application receives notifications from the service through the callback interface.

You write the following code segment for the client application to use the generated proxy. (Line numbers are included for reference only.)

01

02 client.CheckAvailableProducts()

You need to set up duplex communication between the client application and the WCF service. Which code segment should you insert at line 01?

A.Dim client As StoreClient = _New StoreClient(New InstanceContext(GetType(StoreCallback)))

B.Dim client As StoreClient = _New StoreClient(OperationContext.Current.InstanceContext)

C.Dim client As StoreClient = _New StoreClient(New InstanceContext(New StoreCallback()))

D.Dim callback As IStoreCallback = _OperationContext.Current.GetCallbackChannel(Of IStoreCallback)()Dim context As New InstanceContext(callback)Dim client As StoreClient = _New StoreClient(context)

Answer: C

Question: 56

You create a client application by using Microsoft .NET Framework 3.5.

The client application consumes a Windows Communication Foundation service that uses the netMsmqBinding binding.

The binding uses a private transactional queue named Library.

The following code fragment is part of the application configuration file. (Line numbers are included for reference only.)

01 <endpoint binding="netMsmqBinding"

02 contract="ServiceReference.ILibrary"

03

04 />

You need to specify the address of the endpoint.

Which attribute should you insert at line 03?

A.Address=".\private$\Library"

B.Address="net.msmq://.\private$\Library"

C.Address="net.msmq://localhost/private/Library"

D.Address="net.msmq://localhost/private/transactional/Library"

Answer: C

Question: 57

You are creating a client application by using Microsoft .NET Framework 3.5.

The client application will consume a COM+ application by using the Windows Communication Foundation service.

You write the following code segment to implement the COM+ application. <Guid("InterfaceGuidIsHere")> _

Public Interface IDocumentStore

Function IsDocumentExist(ByVal id As Long) As Boolean End Interface

<Guid("ClassGuidIsHere")> _

Page 67 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Public Class DocumentStore

Inherits ServicedComponent

Implements IDocumentStore

Public Function IsDocumentExist(ByVal id As Long) _

As Boolean Implements IDocumentStore.IsDocumentExist 'This code checks if document exists

End Function End Class

The application ID of the COM+ application is {AppGuidIsHere}.

You need to configure the WCF service to access the COM+ application from the WCF client application. Which code fragment should you use?

A.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="IDocumentStore"/> </service></services>

B.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="{InterfaceGuidIsHere}"/> </service></services>

C.<services> <service name="{AppGuidIsHere},{ClassGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="DocumentStorage.IDocumentStore"/> </service></services>

D.<services> <service name="{AppGuidIsHere}"> <endpoint binding="wsHttpBinding" contract="{InterfaceGuidIsHere}"/> </service></services>

Answer: B

Question: 58

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

The service contains the following code segment. <ServiceContract()> _

Public Interface IMathSrvc <OperationContract()> _

Sub AddNumbers(ByVal num As Integer) <OperationContract()> _

Function Clear() As Integer End Interface

You need to ensure that the service meets the following requirements: The service can call the AddNumbers operation multiple times.

The AddNumbers operation must start a session on the initial call. The service must call the Clear operation only if a session exists.

The service must not call other operations after it calls the Clear operation. Which code segment should you use to replace the existing code segment?

A.<ServiceContract()> _ Public Interface IMathSrvc <OperationContract(IsOneWay:=True)> _ Sub

AddNumbers(ByVal num As Integer) <OperationContract(IsTerminating:=True)> _ Function Clear() As

IntegerEnd Interface

B.<ServiceContract()> _ Public Interface IMathSrvc <OperationContract(IsTerminating:=False)> _ Sub

AddNumbers(ByVal num As Integer) <OperationContract(IsTerminating:=True)> _ Function Clear() As

IntegerEnd Interface

C.<ServiceContract()> _ Public Interface IMathSrvc <OperationContract(IsInitiating:=True, IsOneWay:=True)> _ Sub AddNumbers(ByVal num As Integer) <OperationContract(IsTerminating:=True)>

Page 68 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

_ Function Clear() As IntegerEnd Interface

D. <ServiceContract()> _ Public Interface IMathSrvc <OperationContract()> _ Sub AddNumbers(ByVal num As Integer) <OperationContract(IsInitiating:=False, IsTerminating:=True)> _ Function Clear() As

IntegerEnd Interface

Answer: D

Question: 59

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

<ServiceContract( _

CallbackContract:=GetType(IMyServiceCallback))> _

Public Interface IMyService

<OperationContract()> _

Sub MyMethod()

End Interface

<ServiceContract()> _

Public Interface IMyServiceCallback

<OperationContract()> _

Sub CallbackMethod()

End Interface

The implementation of the MyMethod operation must call back the CallbackMethod operation. You need to ensure that the service meets the following requirements:

The CallbackMethod operation is able to call the service. The service instance is thread-safe.

Which service implementation should you use?

A.<ServiceBehavior()> _ Public Class ServiceImpl Implements IMyService Public Sub MyMethod() _

Implements IMyService.MyMethod Dim cb As IMyServiceCallback = _ OperationContext.Current.GetCallbackChannel( _ Of IMyServiceCallback)() cb.CallbackMethod() End

SubEnd Class

B.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Single)> _ Public Class ServiceImpl Implements IMyService Public Sub MyMethod() _ Implements IMyService.MyMethod Dim cb As IMyServiceCallback = _ OperationContext.Current.GetCallbackChannel( _ Of IMyServiceCallback)()

cb.CallbackMethod() End SubEnd Class

C.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple)> _ Public Class ServiceImpl

Implements IMyService Public Sub MyMethod() _ Implements IMyService.MyMethod Dim cb As IMyServiceCallback = _ OperationContext.Current.GetCallbackChannel( _ Of IMyServiceCallback)()

cb.CallbackMethod() End SubEnd Class

D.<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Reentrant)> _ Public Class ServiceImpl

Implements IMyService Public Sub MyMethod() _ Implements IMyService.MyMethod Dim cb As IMyServiceCallback = _ OperationContext.Current.GetCallbackChannel( _ Of IMyServiceCallback)()

cb.CallbackMethod() End SubEnd Class

Page 69 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer: D

Question: 60

You are creating a remote database management application by using Microsoft Windows Forms and Microsoft .NET Framework 3.5. You use the Windows Communication Foundation model to create the application.

You write the following code segment. (Line numbers are included for reference only.)

01 Public Class QueryAnalyzerService

02 Implements IQueryAnalyzerService, IDisposable

03

04 Public Sub Open()

05 ...

06 End Sub

07 Public Sub ExecuteSql(ByVal sql As String)

08 ...

09 End Sub

10 Public Sub Close()

11...

12End Sub

13Public Sub Dispose() Implements IDisposable.Dispose

14...

15End Sub

16...

17End Class

You need to ensure that each time a client application calls the Open() method, a new service instance is created.

Which code segment should you insert at line 03?

A.<OperationBehavior(TransactionScopeRequired:=True)> _

B.<OperationBehavior(AutoDisposeParameters:=True)> _

C.<OperationBehavior( _ ReleaseInstanceMode:=ReleaseInstanceMode.None)> _

D.<OperationBehavior( _ ReleaseInstanceMode:=ReleaseInstanceMode.BeforeCall)> _

Answer: D

Question: 61

You create a Windows Communication Foundation (WCF) service by using Microsoft .NET framework 3.5.

You write the following code segment for a service contract. <ServiceContract()> _

Public Interface IOrderManager <OperationContract()> _

Sub ProcessOrder(ByVal orderId As Integer) End Interface

You need to ensure that the WCF service meets the following requirements: The ProcessOrder method uses transactions.

The ProcessOrder method commits automatically if no exception occurs. Which method implementation should you use?

A. <TransactionFlow(TransactionFlowOption.NotAllowed)> _ <OperationBehavior()> _ Public Sub ProcessOrder(ByVal orderId As Integer) _ Implements IOrderManager.ProcessOrderEnd Sub

Page 70 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

B.<OperationBehavior(TransactionScopeRequired:=True, _ TransactionAutoComplete:=True)> _ Public Sub

ProcessOrder(ByVal orderId As Integer) _ Implements IOrderManager.ProcessOrderEnd Sub

C.<TransactionFlow(TransactionFlowOption.Allowed)> _ <OperationBehavior(TransactionScopeRequired:=False, _ TransactionAutoComplete:=True)> _ Public Sub

ProcessOrder(ByVal orderId As Integer) _ Implements IOrderManager.ProcessOrderEnd Sub

D.<TransactionFlow(TransactionFlowOption.Allowed)> _ <OperationBehavior(ReleaseInstanceMode:= _ ReleaseInstanceMode.AfterCall, _ TransactionScopeRequired:=True, _ TransactionAutoComplete:=False)> _

Public Sub ProcessOrder(ByVal orderId As Integer) _ Implements IOrderManager.ProcessOrderEnd Sub

Answer: B

Question: 62

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You write the following code segment.

01 <ServiceContract()> _

02 Public Class MyService

03 <OperationContract()> _

04

05 Public Sub MyMethod()

06 End Sub

07 End Class

The service uses a transactional binding. The TransactionFlow property for the binding is set to True. You need to ensure that the MyMethod method meets the following requirements:

The method uses a client-side transaction if a client-side transaction exists.

The method uses a server-side transaction if a client-side transaction does not exist. Which code segment should you insert at line 04?

A.<OperationBehavior(TransactionScopeRequired:=True)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _

B.<OperationBehavior(TransactionScopeRequired:=True)> _ <TransactionFlow(TransactionFlowOption.Mandatory)> _

C.<OperationBehavior(TransactionScopeRequired:=False)> _ <TransactionFlow(TransactionFlowOption.Allowed)> _

D.<OperationBehavior(TransactionScopeRequired:=False)> _ <TransactionFlow(TransactionFlowOption.Mandatory)> _

Answer: A

Question: 63

You create a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following code segment to define the service. (Line numbers are included for reference only.)

01

02 Public Interface IMyService

03 <OperationContract()> _

04 Sub ProcessOrder(ByVal orderId As Integer)

Page 71 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

05 End Interface

06 Public Class ServiceImpl

07 Implements IMyService

08 <OperationBehavior(TransactionAutoComplete:=False, _

09 TransactionScopeRequired:=True)> _

10 Public Sub ProcessOrder(ByVal orderId As Integer) _

11 Implements IMyService.ProcessOrder

12

13 End Sub

14 End Class

You need to set the ServiceContract attribute for the transaction behavior of the service. Which code segment should you insert at line 01?

A.<ServiceContract(SessionMode:=SessionMode.Required)> _

B.<ServiceContract(SessionMode:=SessionMode.Allowed)> _

C.<ServiceContract(SessionMode:=SessionMode.Allowed, _ ProtectionLevel:=ProtectionLevel.EncryptAndSign)> _

D.<ServiceContract(SessionMode:=SessionMode.NotAllowed, _ ProtectionLevel:=ProtectionLevel.EncryptAndSign)> _

Answer: A

Question: 64

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The WCF service will validate certificates to authorize client applications. You write the following code segment.

Class Store Implements IStore

Public Sub RemoveOrder(ByVal ordered As Integer) _ Implements IStore.RemoveOrder

End Sub

End Class

You need to ensure that only those client applications that meet the following criteria can access the RemoveOrder method:

"AdminUser" is the subject in the client certificate. "1bf47e90f00acf4c0089cda65e0aadcf1cedd592" is the thumbprint in the client certificate. What should you do?

A.Decorate the RemoveOrder method by using the following attribute. <PrincipalPermission(SecurityAction.Demand, _Name:="AdminUser;1bf47e90f00acf4c0089cda65e0aadcf1cedd592")> _ Initialize the serviceAuthorization

element of the service behavior in the following manner. <serviceAuthorization principalPermissionMode="Windows"/>

B.Decorate the RemoveOrder method by using the following attribute. <PrincipalPermission(SecurityAction.Demand, _Role:="CN=AdminUser,1bf47e90f00acf4c0089cda65e0aadcf1cedd592")> _ Initialize the serviceAuthorization element of the service behavior in the following manner. <serviceAuthorization

principalPermissionMode="Windows"/>

C.Decorate the RemoveOrder method by using the following attribute. <PrincipalPermission(SecurityAction.Demand,

Page 72 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

_Role:="AdminUser,1bf47e90f00acf4c0089cda65e0aadcf1cedd592")> _ Initialize the serviceAuthorization

element of the service behavior in the following manner. <serviceAuthorization principalPermissionMode="UseAspNetRoles"/>

D. Decorate the RemoveOrder method by using the following attribute. <PrincipalPermission(SecurityAction.Demand, _Name:="CN=AdminUser;1bf47e90f00acf4c0089cda65e0aadcf1cedd592")> _ Initialize the serviceAuthorization element of the service behavior in the following manner. <serviceAuthorization

principalPermissionMode="UseAspNetRoles"/>

Answer: D

Question: 65

You are creating a distributed application by using Microsoft .NET Framework 3.5. You use Windows Communication Foundation (WCF) to create the application. The client application is used in Company A, and the service application is used in Company B. Company A and company B have security token services named STS_A and STS_B respectively. You need to authenticate the client application by using federated security. Which combination of bindings should you use?

A.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF service wsFederationHttpBinding for the STS_A servicewsFederationHttpBinding for the STS_B service

B.wsFederationHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsHttpBinding for the STS_A servicewsHttpBinding for the STS_B service

C.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsHttpBinding for

the STS_A servicewsFederationHttpBinding for the STS_B service

D.wsHttpBinding for the client applicationwsFederationHttpBinding for the WCF servicewsFederationHttpBinding for the STS_A servicewsHttpBinding for the STS_B service

Answer: B

Question: 66

You are creating a distributed application by using Microsoft .NET Framework 3.5. The application uses the Windows Communication Foundation model.

You need to ensure that the following requirements are met: User authentication is performed at the message level. Data protection is performed at the transport level.

Server authentication is performed at the transport level.

What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

A.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > </security> </binding> </wsHttpBinding></bindings>

B.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Certificate" /> <message clientCredentialType="None"/> </security> </binding> </wsHttpBinding></bindings>

C.<bindings> <wsHttpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Windows" /> <message clientCredentialType="None"/> </security> </binding> </wsHttpBinding></bindings>

D.<bindings> <netTcpBinding> <binding name="main"> <security mode="TransportWithMessageCredential" > <transport clientCredentialType="Certificate" /> <message clientCredentialType="Certificate"/> </security> </binding> </netTcpBinding></bindings>

Page 73 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Answer: A, D

Question: 67

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5.

The WCF service must authenticate the client applications by validating credit card numbers and expiry dates.

You write the following code segment. (Line numbers are included for reference only.)

01 Class CreditCardTokenAuthenticator

02 Inherits SecurityTokenAuthenticator

03 Protected Overrides Function ValidateTokenCore( _ ByVal token As SecurityToken) _

As ReadOnlyCollection(Of IAuthorizationPolicy)

04 Dim _creditCardToken As CreditCardToken = _ CType(token, CreditCardToken)

05

06 End Function

07 Private Function IsCardValid( _ ByVal cardNumber As String, _ ByVal expirationDate As DateTime) _ As Boolean

08 'Validation code comes here

09 End Function10 End Class

You need to implement custom authentication for the WCF service.

Which code segment should you insert at line 05?

A.If IsCardValid(_creditCardToken.CardNumber, __creditCardToken.ValidTo) Then Return NothingElse

Throw New SecurityTokenValidationException()End If

B.If IsCardValid(_creditCardToken.CardNumber, __creditCardToken.ValidTo) Then Throw New SecurityTokenValidationException()Else Return NothingEnd If

C.If IsCardValid(_creditCardToken.CardNumber, __creditCardToken.ValidTo) Then Return NothingElse

Return New List(Of IAuthorizationPolicy)(0).AsReadOnly()End If

D.If IsCardValid(_creditCardToken.CardNumber, __creditCardToken.ValidTo) Then Return New List(Of

IAuthorizationPolicy)(0).AsReadOnly()Else Return NothingEnd If

Answer: D

Question: 68

You are creating a distributed application by using Microsoft .NET Framework 3.5. The application uses Windows Communication Foundation (WCF). The distributed application provides point-to-point security. You need to ensure that the distributed application provides end- to-end security instead of point-to-point security. Which binding mode should you use?

A.netTcpBinding with Transport security

B.wsHttpBinding with Transport security

C.wsHttpBinding with Message security

D.netNamedPipeBinding with Transport security

Answer: C

Question: 69

Page 74 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating an application in Windows Communication Foundation (WCF) by using Microsoft.NET Framework 3.5

You need to ensure that the client application communicates with the service by using a duplex contract.

Which five actions should you perform?(To answer,move the five appropriate actions from the list of actions to the answer area,and arrange them in the correct order.)

Answer: Check CertWays eEngine, Download from Member Center

Question: 78 You are creating a Windows Communication Foundation service by using Microsoft

.NET Framework 3.5. The service will be hosted on a Web server. You need to ensure that the service is able to access the current HttpContext instance. Which configuration settings and attribute should you use?

A.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Allowed)]

B.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="false" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Allowed)]

C.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.NotAllowed)]

D.<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="false" /> </system.serviceModel> [AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Required)]

Answer: A

Question: 70

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a Windows Service environment. You need to create a Windows Service class that instantiates a service host. Which code segment should you use?

A.Public Class WindowsExamService Inherits ServiceController Private _serviceHost As ServiceHost

Public Shadows Sub Start() serviceHost = New ServiceHost(GetType(ExamService)) _serviceHost.Open()

End SubEnd Class

B.Public Class WindowsExamService Inherits ServiceHostBase Private _serviceHost As ServiceHost

Public Shadows Sub Open() _serviceHost = New ServiceHost(GetType(ExamService)) _serviceHost.Open() End SubEnd Class

C.Public Class WindowsExamService Inherits ServiceBase Private _serviceHost As ServiceHost Protected

Overrides Sub OnStart(ByVal args() As String) _serviceHost = New ServiceHost(GetType(ExamService))

_serviceHost.Open() End SubEnd Class

D.Public Class WindowsExamService Inherits ServiceHost Private _serviceHost As ServiceHost Public

Shadows Sub Open() _serviceHost = New ServiceHost(GetType(ExamService)) _serviceHost.Open() End

SubEnd Class

Answer: C

Page 75 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

Question: 71

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be exposed for consumption. You need to ensure that the service supports interoperability with the broadest possible number of Web Service toolkits. The service must also support transport-level security. Which configuration setting should you use?

A.<endpoint address="" binding="basicHttpBinding" contract="IContract"></endpoint>

B.<endpoint address="" binding="wsHttpBinding" contract="IContract"></endpoint>

C.<endpoint address="" binding="wsDualHttpBinding" contract="IContract"></endpoint>

D.<endpoint address="" binding="wsFederationHttpBinding" contract="IContract"></endpoint>

Answer: A

Question: 72

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You find that the service starts even though the endpoints have not been configured correctly. You need to create a custom service behavior that throws an exception if the list of endpoints that are configured is not complete. Which code segment should you use?

A.Class CustomBehavior Implements IServiceBehavior Public Sub Validate(ByVal serviceDescription _ As

ServiceDescription, _ ByVal serviceHostBase As ServiceHostBase) _ Implements IServiceBehavior.Validate

'Validates list of endpoints MyValidationMethod() End SubEnd Class

B.Class CustomBehavior Implements IEndpointBehavior Public Sub Validate(ByVal endpoint As ServiceEndpoint) _ Implements IEndpointBehavior.Validate 'Validates list of endpoints MyValidationMethod() End SubEnd Class

C.Class CustomBehavior Implements IContractBehavior Public Sub Validate(ByVal contractDescription _

As ContractDescription, _ ByVal endpoint As ServiceEndpoint) _ Implements IContractBehavior.Validate

'Validates list of endpoints MyValidationMethod() End SubEnd Class

D.Class CustomBehavior Implements IOperationBehavior Public Sub Validate(ByVal operationDescription

As _ OperationDescription) _ Implements IOperationBehavior.Validate 'Validates list of endpoints MyValidationMethod() End SubEnd Class

Answer: A

Question: 3

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will be hosted in a managed Console application. The service endpoint has an address that is relative to the base address of the service. You need to programmatically add the base address to the service. What should you do?

A.Call a constructor of the ServiceHost class.

B.Call an AddServiceEndpoint method of the ServiceHost class.

C.Create and add a custom endpoint behavior to the service.

D.Create and add a custom operation behavior to the service.

Answer: A

Question: 74

Page 76 of 77


Exam Name: TS: MS.NET Framework 3.5, Windows Communication Foundation Application

Developer

Exam Type: Microsoft    
Exam Code: 70-503) Total Questions: 150

You are creating a Windows Communication Foundation (WCF) service by using Microsoft .NET Framework 3.5. You need to use a custom service host to host the WCF service in Windows Activation Services (WAS). What should you do?

A.Write hosting code for the WCF service.

B.Add a reference to the custom service host in the web.config file.

C.Add code to instantiate the custom service host from within the main procedure of the WCF service.

D.Create a custom service host factory that instantiates the custom service host. Include a reference to this factory in the .svc file.

Answer: D

Question: 75

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.

You write the following XML code fragment. <service name="Contoso.Exams.ExamService" behaviorConfiguration="ExamServiceBehavior"> <host>

<baseAddresses>

<add baseAddress="http://localhost:8000/ServiceModelExam/service"/> </baseAddresses>

</host> </service>

You need to add an endpoint definition to the service configuration for the URL http://localhost:8000/ServiceModelExam/service to expose the Contoso.Exams.IExam service contract.

Which definition should you add?

A.<endpoint address=""binding="wsHttpBinding" contract="Contoso.Exams.IExam" />

B.<endpoint address="/service" binding="wsHttpBinding" contract="Contoso.Exams.IExam" />

C.<endpoint address="/service" binding="basicHttpBinding" contract="Contoso.Exams.IExam" />

D.<endpoint address="http: //localhost:8000/ServiceModelExam/service" binding="basicHttpBinding"

contract="IExam" />

Answer: A

End of Document

Page 77 of 77






0 Reply:

Post a Comment

Donate Us!

Thanks Moni