Ik ben me aan het voorbereiden op het MS examen 070-320 , Xml web services & server components in C#.
Ik heb een aantal testvragen gevonden, en ik kom er bij 1 vraag niet uit. Om meer specifiek te zijn, ik ben niet akkoord met de gegeven correcte oplossing.
De vraag luidt als volgt:
Waarom:
In m'n boek, en ook in de MSDN vind ik terug dat, bij server - activated types iedere keer de recentste versie gebruikt wordt als er geen versie-informatie in de config. file gebruikt is. Aangezien er in dit voorbeeld wel een versie-nr wordt meegegeven in de config file, ga ik er dus van uit dat versie 1 van het server - activated object (TKRemoteObj2) gebruikt wordt.
Bij client-activated objects wordt het object gebruikt waartegen gebuild werd. Aangezien in deze nieuwe versie voor versie2 gebuild werd, zou ik zeggen dus dat versie2 van TKRemoteObj1 gebruikt wordt.
Volgens het document waar ik die vraag uit heb, is het correcte antwoord B, net het omgekeerde dus van wat ik dacht.
Dit is trouwens de argumentatie van de auteur van dat document:
) over welke optie nu correct is?
Dit haal ik trouwens uit de MSDN wb Server Activated objects:[nohtml]
Ik heb een aantal testvragen gevonden, en ik kom er bij 1 vraag niet uit. Om meer specifiek te zijn, ik ben niet akkoord met de gegeven correcte oplossing.
De vraag luidt als volgt:
Nu is volgens mij het correcte antwoord C.You create version 1.0.0.0 of an assembly named TestKiAssembly. You register the
assembly in the global assembly cache.
TestKiAssembly consists of two .NET Remoting objects named TKRemoteObject1 and
TKRempoteObject2 These objects are configured in the App.config file of
TestKiAssembly as shown in the following code segment:
code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17<system.runtime.remoting> <application> <service> <activated type="TestKiAssembly.TKRemoteObject1, TestKiAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=28dckd83491duj" /> <wellKnown mode="SingleCall" objectUri="TKRemoteObject2.rem" type="TestKiAssembly.TKRemoteObject2, TestKiAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=28dckd83491duj" /> <channels> <channel ref="http" /> </channels> </service> </application> </system>
You create an application named TKApp that resides on a different computer than
TestKiAssembly. TKApp references version 1.0.0.0 of TestKiAssembly. TKApp contains
code that activates instances of TKRemoteObject1 and TKRemoteObject2 to use their
services.
Due to changes in business needs, you must update TestKiAssembly. You create version
2.0.0.0 of TestKiAssembly, which is backward compatible, but you do not update any
information in the App.config file of TestKiAssembly. You register version 2.0.0.0 of
TestKiAssembly in the global assembly cache. You then rebuild TKApp.
Which version of the remote object will MyApp activate?
A. Version 1.0.0.0 of TKRemoteObject1; version 1.0.0.0 of TKRemoteObject2.
B. Version 1.0.0.0 of TKRemoteObject1; version 2.0.0.0 of TKRemoteObject2.
C. Version 2.0.0.0 of TKRemoteObject1; version 1.0.0.0 of TKRemoteObject2.
D. Version 2.0.0.0 of TKRemoteObject1; version 2.0.0.0 of TKRemoteObject2.
Waarom:
In m'n boek, en ook in de MSDN vind ik terug dat, bij server - activated types iedere keer de recentste versie gebruikt wordt als er geen versie-informatie in de config. file gebruikt is. Aangezien er in dit voorbeeld wel een versie-nr wordt meegegeven in de config file, ga ik er dus van uit dat versie 1 van het server - activated object (TKRemoteObj2) gebruikt wordt.
Bij client-activated objects wordt het object gebruikt waartegen gebuild werd. Aangezien in deze nieuwe versie voor versie2 gebuild werd, zou ik zeggen dus dat versie2 van TKRemoteObj1 gebruikt wordt.
Volgens het document waar ik die vraag uit heb, is het correcte antwoord B, net het omgekeerde dus van wat ik dacht.
Dit is trouwens de argumentatie van de auteur van dat document:
Wie weet er hier meer vanaf, en kan uitsluitsel geven (onderbouwdAnswer: B
Explanation:
Version 1.0.0.0 of MyRemoteObject1 is used since the following client-activated
configuration is used:code:
1 2<activated type="TestKiAssembly.TKRemoteObject1, Version=1.0.0.0"/>
Theelement Contains information about server-activated objects the
application exposes to clients. TKRemoteObject2 is therefore server-activated. The server
controls what version is activated when a client connects to a server-activated object.
Therefore Version 2.0.0.0 will be used for TKRemoteObject2.
Dit haal ik trouwens uit de MSDN wb Server Activated objects:[nohtml]
En over client-activated objects wordt dit gezegd:The server controls which version of a type is activated when a client connects to a server-activated (or) object. If no version information is provided when the service is configured, the most recent version of the assembly is used when the object is activated. For example, if you have two assemblies, MyHello version 1.0.0.0 and MyHello version 2.0.0.0, the well-known object is activated using the version 2 assembly if no version information is provided. It is important to note that this version is used irrespective of the version referenced when the client was built.
When a client activates a client-activated (that is, an <activated>) object, a network call is immediately sent to the server where the requested object is activated and an object reference to the object is returned to the client. Because it directs the activation of the object, the client also chooses the version of the object to be activated. For example, version 1 of HelloService will be activated on the server if the client was built against version 1 of the object, and version 2 of HelloService will be activated on the server if the client was built against version 2.
It is important to note that you cannot specify the version number for client-activated types when configuring the service. Also, any versioning information provided for server-activated types has no effect on client-activated objects, even if both types are in the same assembly.
For example, suppose you have a client-activated type and a server-activated type in the same assembly, and you build client1 against version 1 and client2 against version 2. If no version information is specified for the server-activated object, client1 will receive version 2 of the server-activated object and version 1 of the client activated object. Client2 will receive version 2 objects for both well-known and activated types.
If you configure the service to use version 1 of the assembly for the well-known object, both clients will receive version 1 of the well-known object while client 1 receives version 1 of the activated type and client 2 receives version 2 of the activated type.
The version activated for a client cannot be configured; the version the client was built against is always used.
[ Voor 4% gewijzigd door whoami op 22-10-2003 15:09 ]
https://fgheysels.github.io/