Sie sind auf Seite 1von 30

MCTS:.NET4.0:ServiceCommunicationApplications EXAM:TS:70513 Question:1 AWindowsCommunicationFoundation(wCF)serviceisselfhostedinaconsoleapplicationThe serviceimplementsthelDataAccesscontract,whichisdefinedintheMyApphcationnamespace.The serviceisimplementedinaclassnamedDataAccessServicewhichimplementsthelDataAccess interfaceandalsoisdefinedintheMyApplicationnamespace.Thehostingcodeisasfollows.(Line numbersareincludedforreferenceonly.) 01staticvoidMain(stnng(jargs) 02{ 03ServiceHosthost 04 05host.OpenO; 06Console.ReadLine0; 07host.

t.CloseO; 08) YouneedtocreateaServiceHostinstanceandassignittothehostvariable,Youalsoneedto instantiatetheservicehost.Whichlineofcodeshouldyouinsertatline04? A.Host=newServiceHost(MyApplication.DataAccessService B.HostznewServiceHostCNyApplicationiDataAccess); C.HostznewServiceHost(typeof(iDataAccess)) D.Host=newServiceHost(typeof(DataAccessService)); Answer:D Question:2 WindowsCommunicationFoundation(WCF)servicewillbehostedinMicrosoftIntemnet InformationServices(uS).YoucreateanewapplicationinuStohostthisserviceandcopythe serviceDLLtothebindirectoryoftheapplication.Youneedtocompletethedeploymentofthis servicetouS.whatshouldyoudonext? A.Createanasmxfileandadda@ServiceHostdirectivetothisfile.Copythefiletotherootofthe applicationdirectory. B.Createan.asmxfileandadda@Registerdirectivetothisfile.Copythefiletothebindirectoyyof theapplication. C.Createasvcfileandadda@ServiceHostdirectivetothisfileCopythefiletotherootofthe applicationdirectory. D.Createa.svcfileandadda@Registerdirectivetothisfile.Copythefiletothebindirectoryofthe application. Answer:C Question:3 YouarebuildingaclientforaWindowsCommunicationFoundation(WCF)service.Youneedto createaproxytoconsumethisserviceWhichclassshouldyouuse? A.ChannelFactory<TChannel>

B.ServiceHost C.ClientRuntime D.CommunicationObject Answer:A Question:4 AWindowsCommunicationFoundation(wCF)servicehasacallbackcontractYouaredevelopinga clientapplicationthatwillcallthisserviceYoumustensurethattheclientapplicationcaninteract withtheWCFservice.Whatshouldyoudo? A.OntheOperationContractAttribute,settheAsyncPattemnpropertyvaluetotrue B.OntheOperationContractAttribute,settheReplyActionpropertyvaluetotheendpointaddressof thechent C.Ontheclient,createaproxyderivedfromDuplexClientBase<TChannel> D.Ontheclient,useGetCallbackChannel<T>. Answer:C Question:5 YouareworkingwithaWindowsCommunicationFoundation(WCF)clientapplicationthathasa generatedproxynamedSampleServiceProxyWhentheclientapplicationisexecuting,inline02of thefollowingcode,thechannelfaults(Linenumbersareincludedforreferenceonly.) 01SampleServiceProxyproxynewSampleServiceProxy() 02try 03{ 04proxyProcesslnvoice(invoice); 05) 06catch 07{ 08(proxy.State==CommunicationState.Faulted) 09{ 10 11) 12) 13proxyUpdateCustomer(customer); Youneedtoretumnproxytoastateinwhichitcansuccessfullyexecutethecallinline13.Which codesegment shouldyouuseatline10? A.Proxy.CloseO; B.ProxynewSampleServiceProxy0;c C.Proxy.AbortO, D.Proxy.Open() Answer:C Question:6 AWindowsCommwicationFoundation(WC9solutionexposesthefolowingcontractoveranHTTP connection.

[ServiceContract] publicinterfaceIDataService { [OperationContract]stringGetDatao; } ExistingclientsaremakingblockingcallstoGetData.CallstoGetDatatakefivesecondstocomplete. Youneedtoallownewclientstoissuenonblockingcallstogetthedata,withoutbreakingany existingclients.whatshouldyoudo? A.Replacetheserviceinterfacewiththefollowingintetfaceandimplementthenewmethods. [ServiceContract| publicintetfaceIDoSomething{[OperationContract]stringDoLongOperation0; [OperationContract(Async Pattern=true)]lAsyncResultBeginDoLongOperation0;n [OperationContract(AsyncPattern=true)]stringEndDoLongOperation(lAsyncResultresult);} B.Replacetheserviceintetfacewiththefollowingintetfaceandimplementthenewmethods. [ServiceContract] publicintetfaceIDoSomething{[OperationContract(AsyncPatterntrue)|lAsyncResult BeginDoLongOperation0;n[OperationContract(AsyncPattern=true)]string EndDoLongOperation(IAsync Resultresult);) C.Generateaproxyclasswithasynchronousmethodsanduseitforthenaclients. D.Addanewendpointtotheservicethatusesafullduplexbridinganduseitforthenewclients. Answer:C Question:7 AWindowsCommunicationFoundation(wCF)clientconfigurationfilecontainsthefollowingxML segmentinthesystemserviceModeleement. <client> <endpointaddress=nettcp:I1serverIContosoSeivicebindingenetTcpBindingIcontractsContoso. IContosoServicenameenetTcp"r> <endpointaddressznet.pipe://localhostlContosoServicebindingenetNamedPipeBinding" contractsContosoIContosoServicenameenetPipe"I> </client> Youneedtocreateachannelfactorythatcansendmessagestotheendpointlisteningat net.pipe://localhostiContosoServicewhichcodesegmentshouldyouuse? A.ChannelFactory<ContosolContoso>factory=newChannelFactory<Contoso.lContoso>(Contoso IContoso) B.ChannelFactory<ContosolContososfactory=newChannelFactory<Contoso. lContoso>(mmetNamedPipeBinding) C.ChannelFactory<ContosolContoso>factorynewChannelFactory<Contoso.lContoso>(netPipe); D.ChannelFactory<Contoso.IContoso>factoyynewChannelFactory<Contoso.lContoso>(net. pipe/llocalhostlContosoSenvice); Answer:C

Question:8 AWindowsCommunicationFoundation(WCF)solutionusesthefollowingcontracts.(Linenumbers areincludedforreferenceonly.) 01[ServiceContract(CallbackContract=typeof(lNameService))] 02publicinterfacelGreetingService 03{ 04[OperationContract] 05stringGetMessage0:n 06} 07 08[ServiceContract] 09publicintetfaceINameService 10{ 11[OperationContract] 12stringGetNameo; 13} WhentheclientcallsGetMessageontheserviceintetface,theservicecallsGetNameontheclient callback.Intheclient,theclassNameServiceimplementsthecallbackcontract.Theclientchannelis createdasfollows. 22lnstanceContextcallbackContext=newlnstanceContext(newNameServicefclient)); 25DuplexChannelFactory<lGreetingService>factory=newDuplexChannelFactory <lGreetingServices(typeof(NameService),binding,address); 26lGreetingServicegreetingService=factory.CreateChanneft); YouneedtoensurethatthesenvicecallbackisprocessedbytheinstanceofNameService.Whatare twopossiblewaystoachievethisgoal?(Eachcorrectanswerpresentsacompletesolution.Choose two.) A.Changeline25tothefollowingcodesegment.DuplexChannelFactory<lGreetingServicesfactory= new DuplexChannelFactory<lGreetingService>(callbackContext,binding,address); B.Changeline26tothefollowingcodesegmentlGreetingServicegreetingServicefactory CreateChannel(c alibackContext); C.Addthefollowingcodesegmentafterline26callbac kContextincomingChannelsAdd((iDuplexChannel)greetingService) D.Addthefollowingcodesegmentafterline26.cailbackContext.OutgoingChannels. Add((lDuplexChannel)greetingService) Answer:A,B Question:9 YouhaveanexistingwindowsCommunicationFoundation(WCF)servicethatexposesaservice contractoverHTTPYouneedtoexposethatcontractoverHTTPandTCPWhatshouldyoudo? A.Addaneticpbaseaddresstothehost. B.AddanendpointconfiguredwithanetTcpBinding

C.AddanendpointbehaviornamednetTcpBehaviortotheexistingendpoint. D.AddabindingconfigurationtotheexistingendpointnamednetTcpBinding Answer:B Question:10 YouaredevelopingaWindowsCommunicationFoundation(WCF)servicethatreadsmessagesfrom apublicnontransactionalMSMQqueueYouneedtoconfiguretheservicetoreadmessagesfrom thefaileddeliveryqueueWhichURIshouldyouspecifyintheendpointconfigurationsettingsofthe service? A.Netmsmq:lllocalhost/msmqS:FailedMessages B.Netmsmq/I1ocalhostJmsmq$DeadLetter C.Netmsmq/Ilocalhostisystem$DeadXact D.Net.msmqJ11ocalhostIsystem$DeadLetter Answer:D Question:11 WindowsCommunicationFoundation(WCF)serviceisselfhostedinaconsoleapplication.The serviceimplementsthelTimeServiceserviceinterfaceintheTimeServiceclass.Youneedto configuretheserviceendpointforHTTPcommunication.Howshouldyoudefinetheserviceand endpointtags? A.Definetheservicetagasfollows<servicenameeTmeServvcew>Definetheendpointtagas follows. <endpointkindeTimeSenviceaddressemttpMocalhost8080/TimeServicebinding wsHttpBindingc ontract:lTimeService/>? B.Definetheservicetagasfollows. <servicenameeTimeService'>cDefinetheendpointtagasfollows.cendpointkIndehlTimeService" addresseThttp:Mocalhost:8080/TimeServicebindingewsHttpBindingcontractslTimeServiceI>? C.Definetheservicetagasfollows.<servicenameelTimeServicer>Definetheendpointtagas follows.<endpoint nameeTimeServ,cewaddressemttphocalhost8080/TimeServicebinding:wsHttpBinding contractlTimeService"/> D.Definetheservicetagasfollows.<senvicenameeTimeServicer>Definetheendpointtagas follows. <endpointaddressehttphlocalhost808OfTimeServicebindingewsHttpBindingcontract YTimeService/> Answer:D Question:12 YouarecreatingawindowsCommunicationFoundation(WCF)service.Youneedtoensurethatthe serviceiscompatiblewfthASPNETtomakeuseofthesessionstate.Whichbindingshouldyouuse? A.NetTcpContextBinding B.BasicHttpContextBinding C.NetTcpBinding D.NetMsmqBinding

Answer:B Question:13 AWindowsCommunicationFoundation(WCF)solutionprcwidesasessionbasedcounter TheserviceisselfhostedThehostingcodeisasfollows ServiceHosthost=new ServiceHost(typeof(CounterService));NetTcpBindingbindingi=newNetTcpBinding(SecurityMode None); hostiftddServiceEndpointCMyAppIicationiCounterService,bindingl,net.tcp://localhost:23456); host.Open0;l ThisserviceiscurrentlyexposedoverTCP,butneedstobeexposedtoexternalclientsoverHTTP. Therefore,anewserviceendpointiscreatedwiththefollowingcode. host.AddServiceEndpoint(MyApplication.lCounterService,binding2,http:Illocalhost:12345); Youneedtocompletetheimplementationandensurethatthesessionbasedcounterwillperform overHTTPasitdoesoverTCP.Whatshouldyoudo? A.Definebinding2asfollowsWS2007HttpBindingbinding2=new WS2007HttpBinding(SecurityMode.None); Configurebinding2asfollowsbinding2.ReliableSession.Enabled=true; B.Definebinding2asfollowsWSHttpBindingbinding2=newWSHttpBinding(SecurityModeNone); Addthe followingbehaviortotheserviceimplemnentationServiceBehavior(lnstanceContextMode lnstanceContextMode.PerSession)] C.Definebinding2asfollows.BasicHttpBindingbinding2=new BasicHttpBinding(BasicHttpSecurityMode.None); Enablecookiesforbinding2.binding2AllowCooldes=true: D.Definebinding2asfollowsBasicHttpBindingbiiding2newBasicHttpBinding(Basic HttpSecurityModeNone) Mdthefollowingbehaviortotheserviceimplementation.[ServiceBehavior(lrstanceContexMode= lnstanceContextModeSingle)] Answer:A Question:14 YouareusingwindowsCommunicationFoundation(WCF)tocreateaservice.Youneedto implementacustommessagelevelsecurttybindingelementWhichbindingelementshouldyou use? A.TransportSecuntyEeement B.HttpsTransportBindingElement C.SslStreamSecuntyBindingElement D.WindowsStreamSecurityBindingElement Answer:A Question:15

YouarecreatingaWindowsCommunicationFoundation(WCF)serviceYouhavethefollowing requirements.MessagesmustbesentoverTCRTheservicemustsupporttransactions.Messages mustbeencodedusingabinaryencodingMessagesmustbesecuredusingWindowsstreambased security.YouneedtoimplementacustombindingfortheserviceInwhichordershouldthebinding stackbeconfigured? A.TcpTransportwindowsStreamSecuritytransactionFlowbinaryMessageEncoding B.transactionflowbinaryMessageEncodingwindowsStreamSecuritytcpTransport C.windowsstreamsecuritytcpTransportbinaryMessageEncodingtransactionFlow D.binaryMessageEncodingtransactionFlowtcpTransportwindowsStreamSecurity Answer:B Question:16 AWindowsCommunicationFoundation(WCF)serviceinteractswiththedatabaseofaworkflow engineDataaccessauthorizationismanagedbythedatabase,whichraisessecurityexceptionsifa userisunauthorizedtoaccessitYouneedtoensurethattheapplicationtransmitstheexceptions raisedbythedatabasetotheclientthatiscallingtheserviceWhichbehaviorshouldyouconfigure andapplytotheservice? A.Routing B.ServiceDebug C.ServiceSecurityAudit D.WorkflowUnhandledException Answer:B Question:17 AWindowsCommunicationFoundation(WCF)servcelistensformessagesat nettcpilwwwcontoso.comMMyService. Ithasalogicaladdressathttp/Iwwwcontosocorn)MyService TheconfigurationfortheWCFclientisasfollows <endpointaddressrhTttpllwwwcontosocom/MyServicebindingenetTcpBinding bindingConfiguratonNetTcpBinding_lMyServicecontract="ServiceReference1.IMyServce name=NetTcpBinding_lllyService"/>v Thegeneratedconfigurationdoesnotprovideenoughinformationfortheclienttocommunicate withtheserver.Youneedtoupdatetheclientsothatitcancommunicatewiththeserver.What shouldyoudo? A.Intheclientconfiguration.changethevalueoftheaddressattributeto nettcp:/Iwwwcontosocom/MyService B.Intheclientconfiguration,changethevalueoftheaddressattributeto net.tcp:Ilwwwcontosocom/MyServicellisten=http:/Iwwwcontosocom/MyService. C.Afterinstantiatingtheclientandbeforeinvokinganyserviceoperation,addthislineofcodeclient Endpoint BehaviorsAdd(newEndpointDiscoveryBehawior0{Enabledtrue});

D.Afterinstantiatingtheclientandbeforeinvokinganyserviceoperation,addthislineofcode. client.Endpoint BehaviorsAdd(newClientViaBehavior(newUhcnet.tcpifwwwcontosocomiIMyService))) Answer:D Question:18 YouhaveanexistingWindowsCommunicationFoundation(WCF)Webservice.TheWebserviceis notrespondingtomessageslargerthan64KB.YouneedtoensurethattheWebservicecanaccept messageslargerthan64KBwithoutgeneratingerrors.Whatshouldyoudo? A.IncreasethevalueofmaxReceivedMessageSizeontheendpointbinding. B.IncreasethevalueofmaxRequestLengthonthehttpRuntimeelement. C.IncreasethevalueofmaxBufferSizeontheendpointbinding. D.IncreasethevalueofmaxBufferPoolSizeontheendpointbinding. Answer:A Question:19 AWindowsCommunicationFoundation(WCF)clientcommunicateswithaservice.Youcreatedthe clientproxybyusingAddServiceReferenceinMicrosoftVisualStudio.Youneedtoensurethatthe clientacceptsresponses ofupto5MBinsize.Whatshouldyouchangeintheconfigurationfile? A.ThevalueofthemaxBufferPoolSizeattributeto5242880 B.ThevalueofthemaxReceivedMessageSizeattributeto5242880 C.ThevalueofthemaxBytesPerReadattributeto5242880 D.ThevalueofthemaxBufferSizeattributeto5242880 Answer:B Question:20 AWindowsCommt.nicationFotrdation(WCF)solutionexposesthefolowingserviceoveraTCP binding(Linerumbersarericludedforr&erenceonly.) 01|ServiceContract] 02[ServiceBehavior(ConcurrenqJAode=ConcsrencyMode.Auttiple)] 03pubbcclassData4ccessServce 04{ 05[OperationContract] O6pubbcvoidPutMssage(stringmessage) 07{ 08MessageDatabam.PutMessage(message); 09) 10(OperationContract] 11pubicstring[]SeachMessages(stnngsearch) 12{ 13retumMessageDatabase.SewchMessages(search), 14) 15}

MessageDatabasesupportsalirmitednumberofconcurrertexecutionsofitsmethods.Youneedto changetheservicetoallowuptothemaximumnumberofexecutionsofthemethodsof MessageDatabaseThisshouldbeimpementedwithoutpreventingcustomersfromconnectingtothe service.Whatshouldyoudo? A.Changetheservicebehaviorasfollows.[ServiceBehawior(ConcurrencyMbde=ConctrrencyMode tkultiple,lnstanceContextMode=InstanceContextMode.Single)] B.Changetheservicebehaviorasfollows.[ServiceBehavior(ConcurrencyMode=ConcurrencyMode. Single,lnstanceContextMode=lnstanceContextModePerSession)J C.Addathrottlingbehaviortotheservice,andconfigurethemexConcurrertCalls D.uddathrottlingbehaviortotheservice,andconfigurethemmxConcurrertSessions. Answers:C Question:21 FourWndowsCorrmmunicationFoundation(VVCF)servicesarehostedinMicrosoftInternet InformationServces(uS).NobetaviorconfigirationexistsinthewebconfigfiIeYouneedtoconfigtre theapplicaionsothateveryserviceandendpointlimitsthenumberofconcurrentcallsto50andthe riumberofconcurrentsesgonsto25.WhichxMLsegmeltshouldyouaddtothesystemserviceModel configt.rationsectionofthewebconfigfile? A.<behavors><serviceBehaviors><behaviormee">o<serviceThrottlingmaxConcurrertCallse50 maxConc urrentSessionse25"Is<Ibehawor>i</serviceBehaviors></behavors> B.<behaviors><serviceBehaviors><behaviornameedefaulr><serviceThrottling maxConcunentCalls5(T maxConcunentSessions25/s</behaviors<lserviceBehaviors></behaviors> C.<behaviors><serviceBehaviors><behaviormeeMe>i<serviceThrottlingmaxConcurrentCallse50 maxConcurrentSessions25I></beha,ior></serviceBehaviors></behaviors> D.<behawv,ors><serviceBehaviors><behaviornameALL><serviceThrottlingnaxConc urrei1Callse50 maxConcurret1Sessionss257></behavior><IservKeBehaviorss</behavors> Answer:C Question:22 YouarecreatingaWindowsCommunicationFoundation(WCF)servicethatisimplementedas follows.(Linenumbersareincludedforreferenceonly.) 01|ServiceContract] 02[ServiceBehavior(includeExceptionDetilslnFaults=true)103putiicclassOrderService 04{ 05[OperationContract] 06putiicvoidSubmitOrder(OrderanOrder) 07{ O8try 09{ 10... 11) 12catch(DivideByZeroExceptonex) 13{

14 15) 16) 17) Youneedtoensurethatthestacktracedetailsoftheexceptionaenotincludedintheerror informationsenttotheclient.Whatshouldyoudo? A.Replaceline14withthefollowingline.throw: B.Replaceline14withthefollowingline thrownewFaultException<Order>(anOrder,ex.ToString()); C.Afterhne05,addthefollowingline. [FaultContract(typeof(FaukEception<Order>)) Replaceline14withthefollowingline throwex; D.Alterhne05,addthefollowingline [FaultContract(typeof(FaultException<Order>)) Replaceline14withthefollowingline. thrownewFaultException<Order>(anOrder,"Dividebyzeroexception): Answer:D Question:23 AWindowsCommunicationFoundation(WCF)serviceimplementsthefollowingcontract(Line numbersareincludedforreferenceonly.) 01[ServiceContract] 02publicinterfacelDataAccessService 03{\ 04[OperationContract] 05voidPutMessage(stringmessage) 06 O7lOperationContractj 08[FaultContract(typeof(TimeoutFaultException))J 09[FaultContract(typeof(FaultException))] 10stringJSearchMessages(stnngsearch); 11) TheimplementationoftheSearchMessagesmethodthrowsTimeoutFaultExceptionexceptionsfor databasetimeouts.TheimplementationoftheSearchMessagesmethodalsothrowsanException foranyotherissueitencounterswhileprocessingtherequest.Theseexceptionsarereceivedonthe clientsideasgenericFaultExceptionexceptions.Youneedtoimplementtheerrorhandlingcode forSearchMessagesandcreateanewchannelontheclientonlyifthechannelfaults.whatshould youdo? A.CatchandhandlebothTimeoutFaultExceptionandFaultException. B.CatchbothTimeoutFaultExceptionandFaultException.Createanewchannelinbothcases. C.CatchandhandleTimeoutFaultExceptionCatchFauftExceptionandcreateanewchannel D.CatchandhandleFaultException.CatchTimeoutFaultExceptionandcreateanewchannel.

Answer:C Question:24 YouarecreatingawindowsCommunicationFoundation(WCF)service.Youdonotwanttoposethe internalimplementationattheservicelayerYouneedtoexposethefollowingclassasaservice namedArithmetictheanoperationnamedSumpublicclassCalculator{publicintAdd(intx,nty){)} Whichcodesegmentshouldyouuse? A.[ServiceContract(Namespace=Arithmetic")JpublicclassCalculator{[Operation Contract(ActionSum)]m publicintAdd(intx,intty){}} B.IServiceContract(ConfigurationName=Arithmetic)JpublicclassCalculator{IOperaion Contract(ActionSum)]mpublicnitAdd(intx,inty)}} C.[ServiceContract(Namie=Arithmetic")]publicclassCalculator([OperationContract(Namee"Sum)] publicint Add(intx,lnty)(} D.[ServiceContract(Namie=Arithmtic)]publicclassCalculator{ (OperationContract(ReplyAction"Sum)]public intAdd(intx,lity)( Answer:C Question:25 YouaredevelopingaclientthatsendsseveraltypesofSOP?messagestoaWindowsCommunication Foundation(WCF)servicemethodnamedPostDataPostDataiscurrentlydefinedasfollows [OperaionContractj?voidPostData(Orderdata);YouneedtomodifyPostDatasothatitcanreceive anySOAPmessagewhichcodesegmentshouldyouuse A.[OperaionContract0sOneWaytrue,Action=v,ReplyActionvoidPostData(Orderdata); B.(OperaionCoritract(1sOneWay=true,Actionv,ReplyAction=.)J addPostData(BodyWriterdata); C.[OperaionContractJvoidPostDaa(BodyWnterdata); D.[OperaionContract]voidPostDaa(Messagedata); Answer:D Question:26 AWindowsCommunicationFoundation(WCF)applicationusesthefollowingdatacontract [DataContract] PublicclassPerson { [DataMember] publicstringfirstName, [DataMember] publicstringlastName: [DataMember] publicintage; [DataMember] publicintID; }

YouneedtoensurethatthefollowingxMLsegmentisgeneratedwhenthedatacontractiserialized. <Person> <firstNamexsi:niletrueI> <lastNamexsi:niltrue"/> <lD>999999999<lD> </Person> Whichcodesegmentshouldyouuse? A.[DataMember| publicstringfirstName; [DataMember] publicstringlastName; [DataMember(EmitDefaultValuetrue)) publicnitage=0; [DataMember(EmitDefaultvaluetrue)] publicintID=999999999; B.[DataMember(EmitDefaultvaluefalse)] publicstringfirstName=null; [DataMember(EmitDefaultValue=false)] publicstringlastName=null; [DataMember(EmitDefaultValue=true)] publicintage=1: [DataMember(EmitDefaultValuefalse)] publicnitID999999999 C.[DataMember(EmitDefaultValue=true)] publicstringfirstName; [Datal\ilember(EmitDefaultValuetrue)] PublicstringIastNarne; [DataMember(EmitDefaultValue=false)] publicnmtage=1 [DataMember(EmitDefaultValuefalse)] publicnitID=999999999 D.[DataIviember] publicstringfirstName=null; [DatalViember] publicstringlastName=null; [DataMember(EmitDefaultValue=false)] publicnitage=0: [DataFvlember(EmitDefaultValuefalse)] publicnitID=999999999; Answer:D Question:27 WindowsCommunicationFoundation(WCF)applicationusesadatacontractthathasseveraldata members.YouneedtheapplicationtothrowaSerializationExceptionifanyofthedatamembers arenotpresentwhenaserializedinstanceofthedatacontractisdesterilized.Whatshouldyoudo? A.AddtheKnownTypeattributetothedatacontract.Setadefaultvalueineachofthedata memberdeclarations.

B.AddtheKnownTypeattributetothedatacontract.SettheOrderpropertyofeachdatamember touniqueintegervalue. C.SettheEmitDefaultValuepropertyofeachdatamembertofalse. D.Settheisrequiredpropertyofeachdatamembertotrue. Answer:D Question:28 YouaredevelopingadatacontractforaWindowsCommunicationFoundation(WCF)service.The datainthedatacontractmustparticipateinroundtrips.Strictschemavalidityisnotrequired.You needtoensurethatthecontractisforwardcompatibleandallowsnewdatamemberstobeadded toit.Whichinterfaceshouldyouimplementinthedatacontractclass? A.lCommunicationObject B.lExtension<T> C.lExtensibleObject<Ts D.lExtensibleDataObject Answer:D Question:29 ThefollowingisanexampleofaSOAPenvelope. <s:Enelopexmlns:sehttp://schemas.xmlsoporg/soap/envelopef> Header> <h:Storeldxmlns:he"http:/!www.contoso.coms6495<Ih:Storeld></s:Header><s:Body> <CheckStockRequestxmlnsehttp://wwwcorIosocom><ltemld>2469<Iltenld>4</CheckStoc kRequest><Is: Body><Is:Envelope> YouneedtocreateamessagecontractthatgeneratestheSOAPenvelope.1whichcodesegment shouldyouuse? A.[MessageContract(WrapperName=http:I/www.contoso.comn)]publicclassCheckStockRequest { [MessageHeader(Nanez"http:llwww.contoso.com)]publicmntStoreld{get;set.} [MessageBodyMember(Nameeintp://www..contoso.com)]publicnititemld{getset;)} B.[MessageContract(WrapperNamespace="http:I/www.contoso.comn)]publicclassCheckStoc kRequest{ [MessageHeader(Namespaces"http:I/www.contosocom)]opublicnmtStoreld{get;set;) [MessageBodyMember(Namespaceshttp://www.contoso.comn)]publicnmtltemld{get;set;}} C.[MessageContract(WrapperNamespace=http://www.contosocom)]pilicclass CheckStockRequest{ [MessageHeader(Namespacesttp://wwwcontoso.comn")]publicmntStoreld{getset.}publicmnt ltemld{get: set;}) D.(MessageContract(WrapperNamespace=httpJ/www.contosocom)]piblicclass CheckStockRequest{ [MessageHeader(Namespace11tp:IIwww.contoso.comn")]publicintStoreld{getset;} (MessageBodyMember] publicintltemmld(getset}} Answer:B

Question:30 YouarecreatingawindowsCommunicationFoundation(WCF)servicetoprocessorders.Thedata contractfortheorderisdefinedasfollows [DataContract] publicclassOrder { [DataMemberl publicstringCardHolderName{get;set; [DataMember] publicstringCreditCardNumber{get;set;} ) Youhavethefollowingrequirements EnablethetransmissionofthecontentsofOrderfromtheclientstotheservice. EnsurethatthecontentsofCreditCardNumberarenotsentacrossthenetworkincleartext. EnsurethatthecontentsofCreditCardNumberareaccessiblebytheservicetoprocesstheorder. YouneedtoimplementtheservicetomeettheserequirementsWhatshouldyoudo A.AddaDataProtectionPermissionattributetotheCreditCardNumberpropertyandsetthe ProtectDatapropertytotrue. B.ConverttheDataContracttoaMessageContractandsettheProtectionLevelpropertyto SignAndEncrypt C.ChangethedatatypeofCreditCardNumberfromstringtoSecureString D.ImplementtheCreditCardNumberpropertygetterandsetterInthesetter,runthevalueofthe CreditCardNumberthroughtheMD5CryptoServiceProviderclassTransformBlockmethod Answer:B Question:31 YouarecreatingaWindowsCommunicationFoundation(WCF)servicethatacceptsmessagesfrom clientswhentheyarestartedThemessageisdefinedasfollows [MessageContract] publicclassAgent { publicstringCodeName{get;set:} publicstringSecretHandshake{get;set;} ) Youhavethefollowingrequirements: TheCodeNamepropertymustbesentincleartext.Theservicemustbeabletoverifythatthe propertyvaluewasnotchangedatterbeingsentbytheclient. rmeSecretHandshakepropertymustnotbesentincleartextandmustbereadablebytheservice. Whatshouldyoudo A.AddaMessageBodyMemberattributetotheCodeNamepropertyandsettheProtectionLevelto Sign.AddaMessageBodyMemberattributetotheSecretHandshakepropertyandsetthe ProtectionLeveltoEncryptAndSign. B.AddaDataProtectionPermissionattributetotheeachpropertyandsettheProtect[)ataproperty totrue

C.AddanxmlTextattributetotheCodeNamepropertyandsettheDataTypepropertytoSignedAdd aPasswordPropertyTextattributetotheSecretHandshakepropertyandsetitsvaluetotrue. D.uddanImmutableObyectattributetotheCodeNamepropertyandsetitsvaluepropertytotrue. AddaBrowsableattributetotheSecretHandshakepropertyandsetitsvaluetofalse. Answer:A Question:32 AWindowsCommunicationFoundation(WCF)clientusesthefollowingservicecontract.(Line numbersareincludedforreferenceonly.) 01[ServiceContract] 02publicinterfaceIService 03( 04[OperationContractj 05stringOperation1O; 06[OperationContract] 07stringOperation2(), 08) YouneedtoensurethatallcallstoOperation1andOperation2fromtheclientareencryptedand signedWhatshouldyoudo? A.SettheProtectionLevelpropertyinline01toEncryptAndSign. B.SettheProtectionLevelpropertyinline04andline06toSign. C.AddaSecurityCriticalAttributeroreachoperation. D.AddaSecunitySafeCriticalAttributeforeachoperation. Answer:A Question:33 AWindowsCommunicationFoundation(wCF)serviceisgeneratingaseparatenamespace declarationforeachbodymemberofamessagecontract,eventhoughallbodymemberssharethe samenamespace.YouneedtosimplifytheXMLrepresentationofyourmessagecontractsothatthe namespaceisonlydeclaredonce.Whatshouldyoudo? A.DeclareawrappernamespaceforthemessagecontractbyusingtheWrapperNamespace propertyoftheMessageContractattribute B.ExplicitlysettheNamespacepropertyofalltheMessageBodyMemberattrbutestothesame namespace. C.DeclareallthebodymembersaspropertiesofaDataContractclassandusetheclassastheonly bodymemberofthemessagecontract. D.DeclareallofthebodymembersaspropertiesofaseparateMessageContractclassandusethe classastheonlybodymemberofthemessagecontract. Answer:C Question:34 YouaredevelopingaWindowsCommunicationFoundation(WCF)service.Youwriteamethod namedSubmitthatacceptsmessagesofthetypeSystem.ServiceModel.Channels.Message.Youneed

toprocessthebodyoftheincomingmessagesmultipletimesinthemethod.Whichtwoactions shouldyouperform?(Eachcorrectanswerpresentspartofthesolution.Choosetwo.) A.UsetheGetBodymethodoftheMessageclasstoreadthecontentofthemessages. B.UsetheCreateBufferedCopymethodoftheMessageclasstoloadthemessagesintomemory. C.UsetheWriteBodyContentsmethodoftheBodyWriterclasstomakeacopyofthemessages. D.UsetheCreateMessagemethodoftheMessageBufferclasstomakeacopyofthemessages. Answer:B,D Question:35 AWindowsCommunicationFoundation(WCF)serviceisresponsiblefortransmittingXML documentsbetweensystems.Theservicehasthefollowingrequirements:Itmustminimizethe transmissionsizebyattachingtheXMLdocumentasiswithoutusingescapecharactersorbase64 encoding.ItmustinteroperatewithsystemsthatuseSOAPbutarenotbuiltonthe.NETplafform. Youneedtoconfiguretheservicetosupporttheserequirements.Whichmessageencodingshould youuse? A.Binarymessageencoding B.MTOM(MessageTransmissionOptimizationMechanism)messageencoding C.Textmessageencodingwithmessageversionsettonone D.TextmessageencodingwithmessageversionsettoSOAP1.2 Answer:B Question:36 TheendpointofaWindowsCommunicationFoundation(WCF)serviceusesbasicHttpBindingforits bindingYourcompanyspolicieshavechangedtorequirethatmessagesnotbesentincleartextYou mustensurethatallmessagesareencryptedwhentravelingacrossthenetworkWhatshouldyou do? A.SettheProtectionLevelAttnbuteontheservicecontractandupdatethebindingattributeinthe endpointelementoftheconfigurationfiletowsHttpBinding B.SettheProtectionLevelAttributeontheservicecontractandupdatethebindingConfiguration attributeintheendpointelementoftheconfigurationfiletowebHttpBinding C.SetthePrincipalPermissionAttributeontheservicecontractandupdatethebindingattributein theendpointelementoftheconfigurationfiletowsHttpBinding D.SetthePnncipalPermissionAttributeontheservicecontractandupdatethebindingConflguration attributeintheendpointeeementoftheconfigurationfiletowsHttpBinding. Answer:A Question:37 SelfhostedWindowsCommunicationFoundation(WCF)serviceusesasecureHTTPbindingwitha customprincipalpermissionmodeThebindingrequiresuserstoprovidetheirWindowslogon credentials.YouneedtoretrievetheidentityofthecallerWhataretwopossiblepropertiesyoucan usetoachievethisgoal?(EachcorrectanswerpresentsacompletesolutionChoosetwo) A.ThreadCurrentPrincipalidentityName B.HttpContext.Current.User.Identity.Name C.ServiceSecurityContext.Current.Primaryidentity.Name D.OperationContextCurrent.ServiceSecurityContextPrimaryidentityName

Answer:C,D Question:38 YouarecreatingaWindowsCommunicationFoundation(WCF)servicethatimplementsthe followingservicecontract. [ServceContractJ publicinterfacelOrderProcessing { [OperationContract] voidApproveOrder(intid) } YouneedtoensurethatonlyuserswiththeManagerrolecancalltheApproveOrdermethodWhat shouldyoudo? A.Inthemethodbody,checktheRightsPosessesPropertypropertytoseeifitcontainsManager B.AddaPnncipalPermissionattributetothemethodandsettheRolespropertytoManager C.AddaSecurityPermissionattributetothemethodandsettheSecurityActiontoDemand D.Inthemethodbody,createanewinstanceofWindowsClaimSet.UsetheFindClaimsmethodto locateaclaimTypenamedRoeewitharightnamedManager Answer:B Question:39 YouaredevelopingaWindowsCommunicationFoundation(WCF)service.Theserviceneedsto accessoutofprocessresourcesYouneedtoensurethattheserviceaccessestheseresourceson behalfoftheonginatingcallerWhatshouldyoudo7 A.SetthevalueofServiceSecurityContextCurrentWindowsidentityImpersonationLevelto TokenlmpersonationLevelImpersonation B.SetthevalueofServiceSecurityContextCurrentWindowsldentityImpersonationLevelto TokenlmpersonationLeve[Delegation. C.SetthePrincipalPermissionAttributeontheservicecontractandupdatethebindingattributein theendpoint elementoftheconfigurationfiletowsHttpBinding D.SetthePnncipalPermissionAttributeontheservicecontractandupdatethebindingConfiguration attributeintheendpointelementoftheconfigurationfiletowsHttpBinding Answer:B Question:40 AWindowsCommunicationFoundation(WCF)serviceexposestwooperations:OpAandOpBOpA needstoexecuteundertheclient'sidentity,andOpBneedstoexecuteundertheservice'sidentity YouneedtoconfiguretheservicetoruntheoperationsunderthecorrectidentityWhatshouldyou do? A.SettheImpersonateCallerForAllOperationspropertyoftheservice'sServiceAuthorizationBehavior totrue.

ApplyanOperationBehaviorattributetoOpAandsettheImpersonationpropertyto ImpersonationOption RequiredApplyanOperationBehaviorattributetoOpBandsettheImpersonationpropertyto ImpersonationOptionAulowed. B.SettheImpersonateCallerForAllOperationspropertyoftheservice'sServiceAuthorizationBehavior totrue. ApplyanOperationBehaviorattributetoOpAandsettheImpersonationpropertyto ImpersonationOption.AllowedApplyanOperationBehaviorattributetoOpBandsetthe Impersonationproperty toImpersonationOptionNotAllowed C.SettheImpersonateCallerForAllOperationspropertyoftheservice'sServiceAuthorizationBehavior tofalse. ApplyanOperationBehaviorattributetoOpAandsettheImpersonationpropertyto ImpersonationOptionAlJlowed. ApplyanOperationBehaviorattributetoOpBandsettheImpersonationpropertyto ImpersonationOptionNotAJlowed D.SettheImpersonateCallerForAllOperationspropertyoftheservice'sServiceAuthorizationBehavior tofalse. ApplyanOperationBehaviorattributetoOpAandsettheImpersonationpropertyto lmpersonationOption.Required.ApplyanOperationBehaviorattributetoOpBandsetthe ImpersonationpropertytoImpersonationOption.Allowed. Answer:D Question:41 AWindowsCommunicationFoundation(WCF)servicethathandlescorporateaccountingmustbe changedtocomplywithgovemnmentregulationsofauditingandaccountabilityYouneedto configuretheWCFservicetoexecuteundertheWindowsloggedonidentityofthecalling applicationWhatshouldyoudo? A.Withintheserviceconfiguration,addaServiceAuthorizationbehaviortotheservice,andset ImpersonateCallerForAulOperationstotrue. B.Withintheserviceconfiguration,addaServiceAuthenticationManagerbehaviortotheservice, andsetServiceAuthenticationManagerTypetoImpersonate. C.wtthintheserviceconfiguration,addaserviceSecurityAuditbehaviortotheservice,andset serviceAuthorizationAuditLeveltoSuccessOrFailure D.Wtthintheserviceconfiguration,addaServiceCredentialsbehaviortotheservice,andsettypeto Impersonate Answer:A Question:42 AWindowsCommunicationFoundation(WCF)serviceisrequiredtologallauthorizationattemptsto theWindowsEventLog.Youneedtoconfigureabehaviorandapplyittotheservicetosupportthis requirement.Whichbehaviorshouldyouconfigureandapply? A.ServiceAuthenticationManager B.ServiceAuthonzation C.ServiceCrederitials D.ServiceSecurityAudit

Answer:D Question:43 YouhaveasecuredWindowsCommunicationFoundation(WCF)serviceYouneedtotrack unsuccessfulattemptstoaccesstheservice.Whatshouldyoudo? A.SettheauthorizationManagerTypeattributeoftheserviceAuthorizationbehaviortoMessage B.SettheincludeExceptionDetailslnFaultsattributeoftheserviceDebugbehaviortotrue C.SettheModeattributeofthesecurityconfigurationelementtoMessage D.SetthemessageAuthenticationAuditLevelattributeoftheserviceSecurityAuditbehaviorto Failure. Answer:D Question:44 YouarecreatingaWindowsCommunicationFoundation(WCF)servicebasedonWSHttpBinding. Newauditrequirementsdictatethatcallersmustbeauthenticatedoneverycalltoensurethattheir credentialshavenotbeenrevoked.Youneedtoensurethattheservicewillnotcachethesecurity requesttoken.Whatshouldyoudo? A.ApplyaServiceBehaviorattributetotheserviceimplementationclasswiththe lnstanceContextModepropertysettoSingle. B.Inthemessagesecurityconfiguration,changeclientCredentialTypefromlssuedTokento UserName C.Inthemessagesecurityconfiguration,setestablishSecurityContexttofalse. D.Attheendofeveryoperation,calltheSessionStateUtility.RaiseSessionEndmethod. Answer:C Question:45 YouhaveaselfhostedWindowsCommunicationFoundation(WCF)service.Youneedtoconfigure theservicetoprovideanX.509certificateduringauthenticationWhatshouldyouusetoconfigure theservice? A.TheCertificatepropertyoftheX509CertificatelnitiatorServiceCredentialclass B.TheSetCertificatemethodoftheX509CertificatelnitiatorServiceCredentialclass C.TheSetCertificatemethodoftheX5O9CertificateRecipientServiceCredentialclass D.TheTrustedStoreLocationpropertyoftheX5O9CertificateRecipientServiceCredentialclass Answer:C Question:46 YouarecreatingaWindowsCommunicationFoundation(WCF)servicethatacceptsclaimsbased tokens.Youneedtoensurethattheservicecanuseclaimsfromtradingpartnerseventhoughthere arevariationsonnamingforthesameelementsWhichtwoactionsshouldyouperform?(Each correctanswerpresentspartofthesolutionChoosetwo.) A.RegisteracustomServiceAuthorizationManagerthatimplementsCheckAccessInthismethod, useSystem. Convert.ChangeTypetotransformtheincomingclaimsettoaWindowsClaimSettype. B.ApplyaPrincipalPermissionattributeontheoperationwiththerequiredclaimslistedintheRoles property.

C.Withintheoperation,verifythepresenceoftherequiredclaimsinthecurrentAuthorization Context D.RegisteranAuthorizationPolicythatmapsexternalclaimstoaninternalClaimSet. Answer:C,D Question:47 AWindowsCommunicationFoundation(WCF)solutionusesthefollowingcontracttosharea messageacrossitsclients.(Linenumbersareincludedforreferenceonly.) 01[ServiceContract] 02publicinterfaceITeamMessageService 03{ 04[OperationContract] 05stringGetMessage0;n 06 07[OperationContract] 08voidPutMessage(stringmessage); 09)Thecodefortheserviceclassisasfollows 10publicclassTeamMessageService:ITeamMessageService 11{ 12Guidkey=GuicLNewGuidO; 13stringmessage=TodaysMessage: 14publicstringGetMessage() 15{ 16returnstringFormat(Message:{0}Key:{ 17},message,Key);1n 18 19publicvoidPutMessage(stringmessage) 20{ 2lthismessage=message; 22} 23)Thesenviceisselfhosted.Thehostingcodeisasfollows. 24ServiceHosthost= 25BasicHttpBindingbinding=newBasicHttpBinding(BasicHttpSecuntyMode.None): 26hostAddServiceEndpoint(HMyApplicationlTeamMessageService,binding,http:/Ilocalhost: 12345w); 27hostOpen0;) YouneedtoensurethatallclientscallingGetMessagewillretrievethesamestring,evenifthe messageisupdatedbyclientscallingPutMessageWhatshouldyoudo A.AddthefollowingattributetotheTeamMessageServiceclass,beforeline10.[Servic eBehavior(lnstanceContextMode=lnstanceContextMode.Single)] B.AddthefollowingattributetotheTeamMessageServiceclass,beforeline10. [ServiceBehavior(lnstanceContextMode=lnstanceContextModePerSession)JThenchangethe binding definitionontheserviceatline25,andontheclienttothefollowingWSHttpBindingbindingnew WSHttpBinding(SecurityModeNone);bindingReliableSession.Enabledtrue;

C.Passaserviceinstancetotheinstancingcodeinline24,asfollows.ServiceHosthost=new ServiceHost(new TeamMessageServiceO); D.Redefinethemessagestringinline13,asfollowsstaticstringmessage=TodaysMessage:Then change theimplementationofPutMessageinlines1922tothefollowingpublicvoidPutMessage(string message){ TeamMessageServicemessagemessage,} Answer:A Question:48 YouaremodifyinganexistingWindowsCommunicationFoundation(WCF)servicethatisdefinedas follows [ServiceContract|publicinterfacelMessageProcessor {[OperaionContract]voidProcessMessxe0:n) publicclassMessageProcessor:IMessageProcessor { publicvoidProcesdiessage(0 {SumrmmtOrderO;} ) Subm(OrdermakesacalltoancrherserviceTheProcesdiessagemethoddoesncperformas expectedunderaheavyload.YouneedtoenableprocessingcImultiplemessages.Newmessages mustonlybeprocessedwhentheProcessMessagemethodisnprocessingrequests,orwhenitis waitingforcallstoSubmitOrdertorectumWhichattributeshouldyouapplytotheMessage Processorclass? A.CallbackBehavior(ConcurrencyModeConcurencyMode.Reentrant) B.CallbackBehavior(ConcurrencyMode=ConcurrencyModeiMultiple)n C.ServiceBehavior(ConcurrencyModeConcurrencyMode.Reentrant) D.ServiceBehavior(ConcurrencyMode=ConcurrencyModePwultiple)y Answer:C Question:49 AwindowsCommunicationFoundation(WCF)solutionusesthefollowingcontracts.(Linenumbers areincludedforreferenceonly.) 01[ServiceContract(CallbackContracttypeof(lNameService))J 02publicinterfacelGreetingSennce 03{ 04[OperationContract] 05stnngGetMessage0, 06) 07[ServiceContract] 08publicinterfaceINameService 09( 10[OperationContractj

11stringGetName(), 12)ThecodethatimplementsthelGreetingServiceinterfaceisasfollows 20publicclassGreetingServicelGreetingService21{22publicstringGetMessage()23{24 INameService clientChannelOperationContextCurrent.GetCallbackChannel<lNameService>0;25sUing clientName= clientChanne[GetNameO;26retumnString.FormatHello{0},clientName);27)28)Theserviceis selfhosted. Thehostingcodeisasfollows.30ServiceHosthost=newServiceHost(typeof(GreetingService));31 NetTcpBindingbinding=newNetTcpBinding(SecurityMode.None);32hostAdd ServiceEndpoint(MyApplication lGreetingService",binding,nettcpillocalhost12345");33hostOpenO:Thecodethatimplementsthe lNameServiceinterfaceisasfollows.40classNameService/:INameService41{42stringname;43 public NameService(stringname)44{45this.name=name;46}47publicstringGetName()48{49return name;50} 51} Currently,thiscodefailsatruntime,andanInvalidOperationExceptionisthrownatline25.You needtocorrectthecodesothatthecallfromtheservicebacktotheclientcompletessuccessfully. Whataretwopossiblewaystoachievethisgoal(Eachcorrectanswerpresentsacompletesolution. Choosetwo.) A.Changetheservicecontractdefinitioninline01asfollows.[ServiceContract(CallbackContract= typeof(lNameService),SessionMode=SessionMode.Required)] B.AddthefollowingattributetotheNameServiceclass,beforeline40. [ServiceBehavior(ConcurrencyMode= ConcurrencyMode.Reentrant)] C.AddthefollowingattributetotheGreetingServiceclass,beforeline20. [ServiceBehavior(ConcurrencyMode= ConcurrencyMode.Reentrant)] D.AddthefollowingattributetotheGreetingServiceclass,beforeline20. [ServiceBehavior(ConcurrencyMode= ConcurrencyMode.Multiple)] Answer:C,D Question:50 AWCFservicecodeisimplementedasfollows.(Linenumbersareincludedforreferenceonly) 01[ServiceContract]02[ServiceBehavior(lnstanceContextMode=03lnstanceContextModeSingle)] 04publicclass CalculatorService05{06[OperationContract]07publicdoubleCalculate(doubleop1,stringop. doubleop2)08{ 24}25}Youneedtoincreasetheratebywhichclientsgettherequiredresponsefromtheservice Whatetwopossblewaystoachievethisgoal?(Eachcorrectanswerpresentsacompletesokiion A.Changethesevvicebehaviortothefollowing.[ServiceBehavior(lnstanceContextMode= lnstanceContextModeSingle,ConcirrencyMode=ConcurrencyMode.Multide)]c B.Changetheservicebehaviortothefollowing.[ServiceBehavior(lnstanceContextMode=

lnstanceContextMode.PerCall)] C.Requiretheclientsusethreads,theParallelTaskLibrary,orothermechanismtoissueservicecalls inparallel. D.Requiretheclientstouseasyncoperationswhencallingthesenvice. Answer:A,B Question:51 YouarecreatingaWindowCommnunicationFoundation(WCF)serviceapplication.Theapplication needstoservicemanyclientsandrequestssimultaneously.Theapplicationalsoneedstoensure subsequentindividualclientrequestsprovideastatefulconversation.Youneedtoconfigtrethe servicetosupporttheserequirements.Whichattributeshouldyouaddtotheclassthatis implementingtheservice? A.[ServiceBehavior(lnstanceContextModelnstanceContextMode.PerSession,ConciirencyMode ConcurrencyMode.Single)] B.[ServiceBehavior(lnstanceContextMode=lnstanceContextMode.PerCall,ConcurrencyModeConc urrencyMode.Reertrant)] C.[ServiceBehavior(InstanceContexlMode=lnstanceContextModePerSession,ConcurrencyMode= ConcurrencyMode.Multiple)] D.[ServiceBehavior(lnstanceContextMode=lnstanceContextModePerCall,ConcurrencyMode= ConcurrencyMode.Multiple)] Answer:C Question:52 AWindowsCommu.nicationFoundation(WCF)solutionusesthefollowngcontract [ServiceContract(SessionModeSessionModeAulowed)JpublicinterfaceIMyService{ [OperaionContractQsTerminatingfalse)voidlnitialize0;[OperaionContractQslnitiatingfalse)]void DoSomethingO; [OperaionContractQsTerminatingtrue)JvoidTerminateO;} Youneedtochangethisinterfacesothat:initializeisallowedtobecalledanytimebefore TemminaeiscalledDoSomethingisalbwedtobecalledonlyafterInitiaiizeiscalled,andnallowed tobecalledafterTerminateiscalledTermnatewillbelowedtobecalledonlyafterInitializeis calledWhichtwoactionsshouldyouperform(Eachcorrectanswerpresentspartofthesdution. Choosetwo) A.ChangetheServiceContractattrtuteoftheIMyServiceinterfacetothefollowing. ServiceContract(SessionMode =SessionModeRequired) B.ChangetheServiceContractattrbuteoftheIMyServiceinterfacetothefollowing ServiceContract(SessionMode SessionModeAllowed) C.ChangetheOperatonContractatributeoftheInitializeoperationtothefollowing. OperationContract(hlnitiating =true,IsTerminating=false) D.ChangetheOperatkonContractatributeoftheTerminateoperationtothefollowing OperabonContract(klnitiating=fase,IsTerminating=true)

Answer:A,D Question:53 AWindowsCommunicationFoL.ndation(WCF)servicehasthefollowingcontract. [ServiceContract]pubhcclass ContoaServicea{[OperaionContract][TransactionFlow(TransactionFlowOpon.Mandatory)] [OperationBehavior(TraisactionScopeRequiredtrue,TransactionAutoCorrolete=false)JvoidTxOp1 (string value){)[OperationCortract(lsTerminatingtrue)J[TransactionFlow(TransactionFlowOption Mandatory)] [OperationBehavior(TraisactionScopeRequiredtrue,TransationAutoCormplete=false)] voidTxOp2(stringvalue){..OperationContext.Current.SetTransactionCompleteO;)) TherviceandtheclientsthatcalltheserviceuseNetTcpBindingwithtransactionflowenabledYou nedtoconfigiretheservicesothatwhenTxOplandTxOp2areiniokedunderthesameclient session,theyrununderthesametransactioncontextWhatshouldyoudo? A.Updatetheservicecontracttoreadasfollows.(ServiceContract(SessionModeSessionMode Required)JAdd thefollowingbehaviortotheserviceimplementation[ServiceBehavior(lnstanceCoritextMode= Instanc eContextMode.PerSession)] B.Updatetheservicecontracttoreadasfollows.[ServiceContract(SessionMode= SessionModeAllowed)]Add thefollowingbehaviortotheserviceimplementabon.[ServiceBehavior(LnstanceContextMode= Instanc eContextModeSingle,ReleaseServicelnstanceQnTransactionCompetefalse)] C.Updatetheservicecontracttoreadasfollows[ServiceContract(SessionMode= SessionMode.Allowed)]Add thefollowngbehaviortotheserviceimplementation.[ServiceBehavior(lnstanceContextMode Instanc eContextMode.Single)] D.Updatetheservicecontracttoreadasfollows.[ServiceContract(SessionMode= SessionMode.Required)]Md thefollowingbehaviortotheserviceimplementation.[ServiceBehavior(lnstanceContextMode= lnstanceContextMode.PerCall)] Answer:A Question:54 AWindowsCommunicationFoundation(WCF)clientandservicesharethefollowingservicecontract interface [ServiceContract]publicinterfaceIContosoService{[OperationContract]voidSavePerson(Person person);} Theyalsousethefollowingbinding. NetTcpBindingbindingnewNetTcpBinding{TransactionFlow=true};

Theclientcallstheservicewiththefollowingcodeusing (TransactionScopets=newTransactionScope(TransactionScopeOption.Required)){IContosoService client=factoryCreateChannelO;clientSavePerson(person); ConsoleWriteLine(TransactionCurrentTransactionlnformation.Distributedldentifier);tsCompleteO;} TheservicehasthefollowingimplementationforSavePerson publicvoidIContosoServiceSavePerson(Personperson){ person.Saveo;ConsoleWriteLine(TransactionCurrentTransactionlnformation.Distributedidentifier);} ThedistributedidentifiersdonotmatchontheclientandtheserverYouneedtoensurethatthe clientandserverenlistinthesamedistributedtransactionWhatshouldyoudo? A.AddthefollowingattributestotheSavePersonoperationonIContosoService. [OperationBehavior(TransactionScopeRequired=true)][TransactionFlow(TransactionFlowOption. Mandatory)] B.AddthefollowingattributestotheSavePersonoperationonlContosoService [TransactionFlow(TransactionFlowOptionMandatory)] [OperationBehavior(TransactionScopeRequiredtrue)] C.AddthefollowingattributetotheSavePersonoperationonlContosoSernce [OperationBehavior(TransactionScopeRequiredtrue)]Mdthefollowingattributetothe implementationof SavePerson.ITransactionFlow(TransachonFlowOptionAiJlowed)] D.AddthefollowingattributetotheSavePersonoperationonlContosoService [TransactionFlow(TransactionFlowOptionAllowed)]Addthefollowingattributetothe implementationof SavePerson.[OperationBehavior(TransactionScopeRequiredtrue)] Answer:D Question:55 Aserviceimplemertsthefollowingcontract.(Linenumbersareincludedforreferenceonly) 01[ServiceContract(SessionModesSessionModeRequired)] 02publicinterfacelContosoSerAce 03{ 04IOperationContract(lsOneWay=true,Islnitiating=true)] 05voidOperationOne(stringvalue); 06 07[OperationContract(lsOneWay=true,Islnitiating=false)] 08voidOperationTvo(stringvalue); 09) Theserviceisimplementedasfdlows. 20classContosoService:lContosoService 21{ 22publicvoidOperaionOne(stringvalue){...) 23 24publicvoidOperaionTwo(stnngvalue){} 25}

ContosoServiceusNetMsmqBindingtolistenformessagesThequeuewassetictousetranections foraddingandremovingmessagesYouneedtoensurethatOperationOneandOperationTwo executeunderthesametransactioncontextwhentheyareinvokedinthesamesessionWhatshould youdo? A.InsertthefollowingtributetoOperationOneonlContosoService ITransactionFlow(TransactionFkwOption Mandatory)]InsertthefollowingattributetoOperationTwonIContosoService ITransactionFlow(TransactionFlcawOptionMandatory)] B.InsertthefollowingtributetoOperationOneonContosoSeivice [OperaionBehavior(Transacbon&opeRequirde=true,TransactionAutoCompletefalse)]Insertthe following attrbutetoOperaionTwoonContosoService.(OperaionBehavior(TransachonScopeRequired=true, TransactionAutoCorrpletetrue)] C.AddthefollowingXMLsegmenttotheapplicationconfigfileinthesystemserviceModel/bindings configuration ction<netMsmqBinding><bindingnameecontosoTxdurabIeetnereceveContextEnabledtrueI> <InetMsmqBinding>ThenusetheNetMsmqBindingnamedcontosoTxtolistenformessagesfrom theclients D.AddthefollowingxMLsegmenttotheapplicationconfigfileinthesystemserviceModel/bindings configuration ction.<customBinding><bindingnameecontosoTx>ctransactionFlowI><binarytvIessageEncoding I> <msmqTransportckurable=stru&/></bindrig><IcustomBinding>ThenusetheCustommiBinding named contosoTxtolistenfcwmessagesfromtheclierts. Answer:B Question:56 YouareintegratingaWindowsCommunicationFoundation(WCF)servicewithinanenterprisewide ServiceOrientedArchitecture(SQA)Yourservicehastherollowingservicecontract. [ServiceContract]publicclass CreditCardConfirmationService{[OperationContractipublicBooleanConfirmCreditCard(stringcc Numberdouble orderAmount,nmtorderNumber){)) YouneedtoallowthecodeintheConfirmCreditCardmethodtoparticipateautomaticallyinexisting transactions.Ifthereisnoexistingtransaction,anewtransactionmustbecreatedautomatically. Whatshouldyoudo? A.InsidetheConfirmCreditCardmethod,surroundthecodethatmustparticipateinthetransaction witha using(newTransactionScopeO)block B.InsidetheConfirmCreditCardmethod,surroundthecodethatmustparticipateinthetransaction witha using(newCommittableTransactionO)block. C.Addan[OperationBehavior(TransactionScopeRequiredtrue)]attributetotheConfirmCreditCard method.

D.Addan[OperationBehavior(TransactionAutoCompletetrue)JattributetotheConfirmCreditCard method. Answer:C Question:57 AWindowsCommunicationFoundation(WCF)applicationexposesaserviceasaSOAPendpointfor consumptionbycrossplatformdentsDuringintegrationtesting,youfindthatoneoftheclientsis notgeneratingthecorrectmessagestotheWCFapplication.Inordertodebugtheissueandfixthe communication,youneedtoconfigurethesenicetologmessagesreceivedfromtheclientWhat shouldyoudo? A.SetanetwTrackingbehaviorontheserviceandconfigurealistenerfortheSystemServiceModel tracesource B.SetanetwTrackingbehaviorontheserviceandconfigurealistenerfortheSystemServiceModel. MessageLoggingtracesource. C.EnablemessageLoggingintheSystemServiceModeldiagnosticselementconfigurationand configurealistenerfortheSystemServiceModelMessageLoggingtracesource. D.EnablemessageLoggingintheSystem.ServiceModeldiagnosticselementconfigurationand configurealistenerfortheSystem.ServiceModeltracesource. Answer:C Question:58 YouwanttodebugtheWindowsCommunicationFoundation(WCF)clientandserverinteraction throughmessageandapplicationtracing.Youneedtocorrelatetracesgeneratedontheclientand theserver.WhichXMLsegmentshouldyouaddtothesystem.diagnosticsconfigurationelementin theclientandserverapplicationconfigurationfile? A.<sources><sourcepropagateActivityetruenameeSystemServiceModelswitc hValuesWarning,ActivityTracing><listenerss<addnamezServiceModelTraceListener/> </listeners></source></sources> B.<sources><sourcenamesSystemServiceModel.MessageLoggingswitchValuee"Verbose"> <listeners><addnamez"ServiceModelTraceListener/><Ilisteners></source></sources> C.<sources><sourcenamesSystem.ServiceModeiMessageLoggingpropagateActivityetrueswitc hValuesWarning,ActivityTracing5<listeners><addname="ServiceModelTraceListenerI> </listeners> </source></sources> D.<sources><sourcenamesSystem.ServiceModelswitchValuesVerboseActivityTracing> <listeners><add namee"ServiceModelTraceListener/></listeners></source></sources> Answer:A Question:59 AWindowsCommunicationFoundation(WCF)serviceonlyacceptsmessagesthataresignedand encryptedAclientapplicationisnotreceivingexpectedresponsesfromtheservice.Youneedto enableloggingtoveritythatthemessagesfromtheclientaresignedandencrypted.Youalsoneed toseewhateachmessagelookslikebeforethemessagebodyisdeserializedintoaNETobjectWhat shouldyoudo?

A.ConfiguretheSystemServiceModeltracesourceinthesystemdiagnosticsconfigurationsection. InthesystemserviceModelconfigurationaddthefollowingxMLsegment<diagnostics><message LogginglogEntireMessagestruelogMessagesAtServiceLeveIetrue" logMessagesAtTransportLeveletrue"/> </diagnostics> B.ConfiguretheSystem.ServiceModeltracesourceinthesystemdiagnosticsconfigurationsection Inthesystem.serviceModelconfiguration,addthefollowingXMLsegment,ediagnostics><message LogginglogEntireMessage=tnelogMessagestServiceLeveItrueIs<Jdiagnostics> C.ConfiguretheSystem.ServiceModelMessageLoggingtracesourceinthesystemdiagnostics configurationsectionInthesystem.serviceModelconfiguration,addthefollowingXMLsegment. ediagnostics><messageLogginglogEntireMessage=trueIogMessagesAtServiceLeveIetrue"log MessagesAtTransportLevel=true"I><Idiagnostics> D.ConfiguretheSystem.ServiceModelMessageLoggingtracesourceinthesystem.diagnostics configurationsection.InthesystemserviceModelconfiguration,addthefollowingxMLsegment <diagnostics><messageLoggingIogMessagesAtServiceLeveletruelogMessagesAtTransport Leveletrue"1></diagnostics> Answer:C Question:60 AWindowsCommunicationFoundation(WCF)servicehasthefollowingcontract. [ServiceContract(Namespaces"http://contoso.com)] publicinterfaceIShipping { [OperationContract| stringDoWork(intid); } Thisisoneofseveralservicecontractshostedbyyourapplication.AllendpointsuseSOAP1.2 bindingswithWSAddressing1.0.TheSystem.ServiceModel.MessageLoggingtracesourceinthe system.diagnosticsconfigurationsectionisconfiguredwithonelistener.Youneedtomakesurethat onlythemessagesthatarereturnedfromtheDoWorkoperationarelogged.WhichXMLsegment shouldyouaddtothesystem.ServiceModel/diagnostics/messageLogging/filtersconfiguration element? A.<addxmlns:addr="http://www.w3.org/2005/08/addressing>//addr:Action[text()= 'http://contoso.com/lShipping/DoWorkResponse]</add> B.<addxmlns:soape"http://www.w3.org/2003/05/soapenvelope>s//soap:Action[text()= 'http://contoso.com/lShipping/DoWorkResponse]<adds C.<addxmlns:addr="http://www.w3.org/2005/08/addressings//addr:Action[text()= http://contoso.com/lShipping/DoWork']<adds D.<addxmlns:soap=http://www.w3.org/2003/05/soapenvelopes//soap:Actiontext()= http://contoso.com/lShipping/DoWork']</adds Answer:A Question:61 YourWindowsCommunicationFoundation(WCF)clientapplicationusesHTTPtocommunicatewith theservice.Youneedtoenablemessageloggingandincludeallsecurityinformationsuchastokens andnoncesinloggedmessages.Whatshouldyoudo?

A.Intheapplicationconfigurationfile,addtheIogKnownPiiattributetothemessagelogging diagnosticssourceandsetthevalueoftheattributetotrue.GeneratetheContosoServiceclass usingtheAddServiceReferencewizard.AddareferencetoSystem.ServiceModel.Routing.dll.Add thefollowingcodesegment. ContosoServiceclient=newContosoServiceO;SoapProcessingBehaviorbehavior=new SoapProcessingBehavior0;behavior.ProcessMessages=true;client.Endpoint. Behaviors.Add(behavior); B.Intheapplicationconfigurationfile,addthefollowingXMLsegmenttothesystem.serviceModel configurationsectiongroup. <diagnostics><messageLoggingIogMessagesAtTransportLeveletrueIogEntireMessagestrue I>c/diagnostics> C.Inthemachineconfigurationfile,addthefollowingXMLsegmenttothesystem.serviceModel configurationsection. <machineSettingsenableLoggingKnownPiiztrueIs GeneratetheContosoServiceclassusingtheAddServiceReferencewizard. Addthefollowingcodesegment. ContosoServiceclient=newContosoServiceO; client.Endpoint.Behaviors.Add(newCallbackDebugBehavior(true)); D.Inthemachineconfigurationfile,addthefollowingxMLsegmenttothesystem.serviceModel configurationsection. <machineSettingsenableLoggingKnownPiiztrueI> Intheapplicationconfigurationfile,addtheIogKnownPiiattributetothemessagelogging diagnosticssourceandsetthevalueoftheattributetotrue.Intheapplicationconfigurationfile,add thefollowingXMLsegmenttothesystem.serviceModelconfigurationsectiongroup. <diagnostics><messageLoggingIogMessagesAtTransportLeveletrue/></diagnostics> Answer:D Question:62 YouaremovingaWindowsCommunicationFoundation(WCF)serviceintoproduction.Youneedto beabletomonitorthehealthoftheservice.Youonlywanttoenableallperformancecounter instancesexposedbytheServiceModelService40.0.0countergroupWhichelementshouldyouadd tothesystem.serviceModelsectionintheapplicationconfigurationfile? A.<diagnosticsperformanceCounters=ServiceOnly/> B.<diagnosticswmiProviderEnabled=trueperformanceCounters=Ofrr> C.<diagnosticsperformanceCounters='Alr1> D.<diagnosticswmiProviderEnabledetrue"I> Answer:A Question:63 YouareimplementingaWindowsCommunicationFoundation(WCF)servicecontractnamed lContosoServiceinaclassnamedContosoService.Theserviceoccasionallyfailsduetoanexception beingthrownattheservice.Youneedtosendthestacktraceofanyunhandledexceptionstoclients asafaultmessage.Whatshouldyoudo? A.Intheapplicationconfigurationfileontheclient,addthefollowingXMLsegmenttothe system.serviceModel/behaviorsconfigurationsectiongroup. <endpointBehaviors><behaviornamesdebug>v

<callbackDebugincludeExceptionDetaillnFaultsetrue1s<behavior></endpointBehaviors> Associatethedebugbehaviorwithanyendpointsthatneedtoreturnexceptiondetails. B.Intheapplicationconfigurationfileontheserviceandalltheclients,addthefollowingXML segmenttothesystem.diagnostics/sourcesconfigurationsectiongroup. <sourcenameeSystem.ServiceModelswitchValueeErrorpropagateActivtfyetruess<listeners> <addnamee"ServiceModelTraceListener initializeData=appntracelog.svclogtypesSystem.Diagnostics.XmlWriterTraceListenerIs </listeners> </source> C.ApplythefollowingattributetotheContosoServiceclass. [ServiceBehavior(lncludeExceptionDetaillnFaults=true)] D.ForeachOperationContractexposedbylcontosoService,applythefollowingattribute. [FaultContract(typeof(Exception))] Answer:C

Das könnte Ihnen auch gefallen