You are on page 1of 13

.

Net Question and Answers


Framework Q&A 1. What are the advantages of .net framework/ explain .net framework? The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet. The .NET Framework is designed to fulfill the following objectives:

To provide a consistent object-oriented programming environment whether object code is stored and executed locall ! executed locall but "nternet-distributed! or executed remotel . To provide a code-execution environment that minimi#es software deplo ment and versioning conflicts. To provide a code-execution environment that guarantees safe execution of code! including code created b an unknown or semi-trusted third part . To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. To make the developer experience consistent across widel var ing t pes of applications! such as Windows-based applications and Web-based applications. To build all communication on industr standards to ensure that code based on the .$%T &ramework can integrate with an other code.

The .NET Framework has two main components: the common language runtime and the .NET Framework class library. The common language runtime is the foundation of the .NET Framework. ou can think of the runtime as an agent that manages code at e!ecution time" providing core services such as memory management" thread management" and remoting" while also enforcing strict type safety and other forms of code accuracy that ensure security and robustness. In fact" the concept of code management is a fundamental principle of the runtime. #ode that targets the runtime is known as managed code" while code that does not target the runtime is known as unmanaged code. The class library" the other main component of the .NET Framework" is a comprehensive" object$oriented collection of reusable types that you can use to develop applications ranging from traditional command$line or graphical user interface %&'I( applications to applications based on the latest innovations provided by )*+.NET" such as ,eb Forms and -./ ,eb services. The .NET Framework can be hosted by unmanaged components that load the common language runtime into their processes and initiate the e!ecution of managed code" thereby creating a software environment that can e!ploit both managed and unmanaged features.

The .NET Framework not only provides several runtime hosts" but also supports the development of third$party runtime hosts. For e!ample" )*+.NET hosts the runtime to provide a scalable" server$ side environment for managed code. )*+.NET works directly with the runtime to enable )*+.NET applications and -./ ,eb services" both of which are discussed later in this topic. Internet E!plorer is an e!ample of an unmanaged application that hosts the runtime %in the form of a .I.E type e!tension(. 'sing Internet E!plorer to host the runtime enables you to embed managed components or ,indows Forms controls in 0T./ documents. 0osting the runtime in this way makes managed mobile code %similar to .icrosoft1 )ctive-1 controls( possible" but with significant improvements that only managed code can offer" such as semi$trusted e!ecution and secure isolated file storage. The following illustration shows the relationship of the common language runtime and the class library to your applications and to the overall system. The illustration also shows how managed code operates within a larger architecture. .NET Framework in context The following sections describe the main components and features of the .NET Framework in greater detail.

Features of the Common Language Runtime


The common language runtime manages memory" thread e!ecution" code e!ecution" code safety verification" compilation" and other system services. These features are intrinsic to the managed code that runs on the common language runtime. ,ith regards to security" managed components are awarded varying degrees of trust" depending on a number of factors that include their origin %such as the Internet" enterprise network" or local computer(. This means that a managed component might or might not be able to perform file$access operations" registry$access operations" or other sensitive functions" even if it is being used in the same active application. The runtime enforces code access security. For e!ample" users can trust that an e!ecutable embedded in a ,eb page can play an animation on screen or sing a song" but cannot access their personal data" file system" or network. The security features of the runtime thus enable legitimate Internet$deployed software to be e!ceptionally feature rich.

The runtime also enforces code robustness by implementing a strict type$and$code$verification infrastructure called the common type system %#T*(. The #T* ensures that all managed code is self$ describing. The various .icrosoft and third$party language compilers generate managed code that conforms to the #T*. This means that managed code can consume other managed types and instances" while strictly enforcing type fidelity and type safety. In addition" the managed environment of the runtime eliminates many common software issues. For e!ample" the runtime automatically handles object layout and manages references to objects" releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors" memory leaks and invalid memory references. The runtime also accelerates developer productivity. For e!ample" programmers can write applications in their development language of choice" yet take full advantage of the runtime" the class library" and components written in other languages by other developers. )ny compiler vendor who chooses to target the runtime can do so. /anguage compilers that target the .NET Framework make the features of the .NET Framework available to e!isting code written in that language" greatly easing the migration process for e!isting applications. ,hile the runtime is designed for the software of the future" it also supports software of today and yesterday. Interoperability between managed and unmanaged code enables developers to continue to use necessary #2. components and 3//s. The runtime is designed to enhance performance. )lthough the common language runtime provides many standard runtime services" managed code is never interpreted. ) feature called just$in$time %4IT( compiling enables all managed code to run in the native machine language of the system on which it is e!ecuting. .eanwhile" the memory manager removes the possibilities of fragmented memory and increases memory locality$of$reference to further increase performance. Finally" the runtime can be hosted by high$performance" server$side applications" such as .icrosoft1 *5/ *erver6 and Internet Information *ervices %II*(. This infrastructure enables you to use managed code to write your business logic" while still enjoying the superior performance of the industry7s best enterprise servers that support runtime hosting.

.NET Framework Class Library


The .NET Framework class library is a collection of reusable types that tightly integrate with the common language runtime. The class library is object oriented" providing types from which your own managed code

can derive functionality. This not only makes the .NET Framework types easy to use" but also reduces the time associated with learning new features of the .NET Framework. In addition" third$party components can integrate seamlessly with classes in the .NET Framework. For e!ample" the .NET Framework collection classes implement a set of interfaces that you can use to develop your own collection classes. our collection classes will blend seamlessly with the classes in the .NET Framework. )s you would e!pect from an object$oriented class library" the .NET Framework types enable you to accomplish a range of common programming tasks" including tasks such as string management" data collection" database connectivity" and file access. In addition to these common tasks" the class library includes types that support a variety of speciali8ed development scenarios. For e!ample" you can use the .NET Framework to develop the following types of applications and services: 'onsole applications. Windows ()" applications *Windows &orms+. ,-..$%T applications. /01 Web services. Windows services. For e!ample" the ,indows Forms classes are a comprehensive set of reusable types that vastly simplify ,indows &'I development. If you write an )*+.NET ,eb Form application" you can use the ,eb Forms classes.

Client Application

e!elopment

#lient applications are the closest to a traditional style of application in ,indows$based programming. These are the types of applications that display windows or forms on the desktop" enabling a user to perform a task. #lient applications include applications such as word processors and spreadsheets" as well as custom business applications such as data$entry tools" reporting tools" and so on. #lient applications usually employ windows" menus" buttons" and other &'I elements" and they likely access local resources such as the file system and peripherals such as printers. )nother kind of client application is the traditional )ctive- control %now replaced by the managed ,indows Forms control( deployed over the Internet as a ,eb page. This application is much like other client applications: it is e!ecuted natively" has access to local resources" and includes graphical elements. In the past" developers created such applications using #9#:: in conjunction with the .icrosoft Foundation #lasses %.F#( or with a rapid

application development %;)3( environment such as .icrosoft1 <isual =asic1. The .NET Framework incorporates aspects of these e!isting products into a single" consistent development environment that drastically simplifies the development of client applications. The ,indows Forms classes contained in the .NET Framework are designed to be used for &'I development. ou can easily create command windows" buttons" menus" toolbars" and other screen elements with the fle!ibility necessary to accommodate shifting business needs. For e!ample" the .NET Framework provides simple properties to adjust visual attributes associated with forms. In some cases the underlying operating system does not support changing these attributes directly" and in these cases the .NET Framework automatically recreates the forms. This is one of many ways in which the .NET Framework integrates the developer interface" making coding simpler and more consistent. 'nlike )ctive- controls" ,indows Forms controls have semi$trusted access to a user7s computer. This means that binary or natively e!ecuting code can access some of the resources on the user7s system %such as &'I elements and limited file access( without being able to access or compromise other resources. =ecause of code access security" many applications that once needed to be installed on a user7s system can now be safely deployed through the ,eb. our applications can implement the features of a local application while being deployed like a ,eb page.

"er!er Application

e!elopment

*erver$side applications in the managed world are implemented through runtime hosts. 'nmanaged applications host the common language runtime" which allows your custom managed code to control the behavior of the server. This model provides you with all the features of the common language runtime and class library while gaining the performance and scalability of the host server. The following illustration shows a basic network schema with managed code running in different server environments. *ervers such as II* and *5/ *erver can perform standard operations while your application logic e!ecutes through the managed code. "er!er#si$e manage$ co$e )*+.NET is the hosting environment that enables developers to use the .NET Framework to target ,eb$based applications. 0owever" )*+.NET is more than just a runtime host> it is a complete architecture for developing ,eb sites and Internet$distributed objects using managed code. =oth ,eb Forms and -./ ,eb services use II* and )*+.NET as

the publishing mechanism for applications" and both have a collection of supporting classes in the .NET Framework. -./ ,eb services" an important evolution in ,eb$based technology" are distributed" server$side application components similar to common ,eb sites. 0owever" unlike ,eb$based applications" -./ ,eb services components have no 'I and are not targeted for browsers such as Internet E!plorer and Netscape Navigator. Instead" -./ ,eb services consist of reusable software components designed to be consumed by other applications" such as traditional client applications" ,eb$based applications" or even other -./ ,eb services. )s a result" -./ ,eb services technology is rapidly moving application development and deployment into the highly distributed environment of the Internet. If you have used earlier versions of )*+ technology" you will immediately notice the improvements that )*+.NET and ,eb Forms offer. For e!ample" you can develop ,eb Forms pages in any language that supports the .NET Framework. In addition" your code no longer needs to share the same file with your 0TT+ te!t %although it can continue to do so if you prefer(. ,eb Forms pages e!ecute in native machine language because" like any other managed application" they take full advantage of the runtime. In contrast" unmanaged )*+ pages are always scripted and interpreted. )*+.NET pages are faster" more functional" and easier to develop than unmanaged )*+ pages because they interact with the runtime like any managed application. The .NET Framework also provides a collection of classes and tools to aid in development and consumption of -./ ,eb services applications. -./ ,eb services are built on standards such as *2)+ %a remote procedure$call protocol(" -./ %an e!tensible data format(" and ,*3/ % the ,eb *ervices 3escription /anguage(. The .NET Framework is built on these standards to promote interoperability with non$ .icrosoft solutions. For e!ample" the ,eb *ervices 3escription /anguage tool included with the .NET Framework *3? can @uery an -./ ,eb service published on the ,eb" parse its ,*3/ description" and produce #A or <isual =asic source code that your application can use to become a client of the -./ ,eb service. The source code can create classes derived from classes in the class library that handle all the underlying communication using *2)+ and -./ parsing. )lthough you can use the class library to consume -./ ,eb services directly" the ,eb *ervices 3escription /anguage tool and the other tools contained in the *3? facilitate your development efforts with the .NET Framework. "f ou develop and publish our own /01 Web service! the .$%T &ramework provides a set of classes that conform to all the underl ing communication standards! such as *2)+" ,*3/" and -./. 'sing those classes enables you to focus on the logic of your service" without concerning yourself with the communications infrastructure re@uired by distributed software development.

&inall ! like Web &orms pages in the managed environment! our /01 Web service will run with the speed of native machine language using the scalable communication of II*. 2. 0anaged code and )nmanaged code

Configuration an$

eployment Tools

Tool ,-..$%T ""- 3egistration Tool *,spnet4regiis.exe+

Description ,llows an administrator or installation program to update the scriptmaps for an ,-..$%T application to point to the ,-..$%T "-,." version associated with the tool. 5ou can also use the tool to perform other ,-..$%T configuration operations. ,ssembl 'ache 6iewer *-hfusion.dll+ ,llows ou to view and manipulate the contents of the global assembl cache using Windows %xplorer. ,ssembl 1inker *,l.exe+ (enerates a file with an assembl manifest from one or more files that are either resource files or 0icrosoft intermediate language *0-"1+ files. ,ssembl 3egistration Tool *3egasm.exe+ 3eads the metadata within an assembl and adds the necessar entries to the registr ! which allows '70 clients to create .$%T &ramework classes transparentl . ,ssembl 8inding 1og 6iewer 9ispla s details for failed assembl binds. *&uslogvw.exe+ This information helps ou diagnose wh the .$%T &ramework cannot locate an assembl at run time. (lobal ,ssembl 'ache Tool *(acutil.exe+ ,llows ou to view and manipulate the contents of the global assembl cache and download cache. While -hfusion.dll provides similar functionalit ! ou can use (acutil.exe from build scripts! makefile files! and batch files. "nstaller Tool *"nstallutil.exe+ ,llows ou to install and uninstall server resources b executing the installer components of a specified assembl . "solated -torage Tool *-toreadm.exe+ 1ists or removes all existing stores for the

$ative "mage (enerator *$gen.exe+

.$%T &ramework 'onfiguration Tool *0scorcfg.msc+

.$%T -ervices "nstallation Tool *3egsvcs.exe+

-oapsuds Tool *-oapsuds.exe+

T pe 1ibrar %xporter *Tlbexp.exe+ T pe 1ibrar "mporter *Tlbimp.exe+

Web -ervices 9escription 1anguage Tool *Wsdl.exe+

Web -ervices 9iscover Tool *9isco.exe+

/01 -chema 9efinition Tool */sd.exe+

currentl logged-on user. 'reates a native image from a managed assembl and installs it in the native image cache on the local computer. .rovides a graphical interface for managing .$%T &ramework securit polic and applications that use remoting services. This tool also allows ou to manage and configure assemblies in the global assembl cache. ,dds managed classes to Windows 2::: 'omponent -ervices b loading and registering the assembl and generating! registering! and installing the t pe librar into an existing '70; 1.: application. <elps ou compile client applications that communicate with /01 Web services using a techni=ue called remoting. (enerates a t pe librar from a common language runtime assembl . 'onverts the t pe definitions found within a '70 t pe librar into e=uivalent definitions in managed metadata format. (enerates code for /01 Web services and /01 Web services clients from Web -ervices 9escription 1anguage *W-91+ contract files! /01 -chema 9efinition */-9+ schema files! and .discomap discover documents. 9iscovers the )31s of /01 Web services located on a Web server! and saves documents related to each /01 Web service on a local disk. (enerates /01 schemas that follow the /-9 language proposed b the World Wide Web 'onsortium *W>'+. This tool generates common language runtime classes and 9ata-et classes from an /-9 schema file.

ebugging Tools Tool 0icrosoft '13 9ebugger *9bg'13.exe+ Description .rovides debugging services with a graphical interface to help application developers find and fix bugs in programs

3untime 9ebugger *'ordbg.exe+

that target the runtime. .rovides command-line debugging services using the common language runtime 9ebug ,.". )sed to find and fix bugs in programs that target the runtime.

"ecurity Tools Tool 'ertificate 'reation Tool *0akecert.exe+ Description (enerates /.?:@ certificates for testing purposes onl . 'ertificate 0anager Tool *'ertmgr.exe+ 0anages certificates! certificate trust lists *'T1s+! and certificate revocation lists *'31s+. 'ertificate 6erification Tool *'hktrust.exe+ 6erifies the validit of a file signed with an /.?:@ certificate. 'ode ,ccess -ecurit .olic Tool ,llows ou to examine and modif *'aspol.exe+ machine! user! and enterprise-level code access securit policies. &ile -igning Tool *-igncode.exe+ -igns a portable executable *.%+ file with an ,uthenticode digital signature. .ermissions 6iew Tool *.ermview.exe+ 9ispla s the minimal! optional! and refused permission sets re=uested b an assembl . 5ou can also use this tool to view all declarative securit used b an assembl . .%6erif Tool *.%verif .exe+ .erforms 0-"1 t pe safet verification checks and metadata validation checks on a specified assembl . -ecutil Tool *-ecutil.exe+ %xtracts strong name public ke information or ,uthenticode publisher certificates from an assembl ! in a format that can be incorporated into code. -et 3egistr Tool *-etreg.exe+ ,llows ou to change the registr settings for the -oftware .ublishing -tate ke s! which control the behavior of the certificate verification process. -oftware .ublisher 'ertificate Test Tool 'reates! for test purposes onl ! a -oftware *'ert2spc.exe+ .ublisherAs 'ertificate *-.'+ from one or more /.?:@ certificates. -trong $ame Tool *-n.exe+ <elps create assemblies with strong names. -n.exe provides options for ke management! signature generation! and signature verification.

%eneral Tools Tool 'ommon 1anguage 3untime 0inidump Tool *0scordmp.exe+ Description 'reates a file containing information that is useful for anal #ing s stem issues in the runtime. The 0icrosoft 9r. Watson tool *9rwatson.exe+ invokes this program automaticall . 1icense 'ompiler *1c.exe+ 3eads text files that contain licensing information and produces a .licenses file that can be embedded in a common language runtime executable. 0anagement -trongl T ped 'lass ,llows ou to =uickl generate an earl (enerator *0gmtclassgen.exe+ bound class in 'B! 6isual 8asic! or C-cript for a specified Windows 0anagement "nstrumentation *W0"+ class. 0-"1 ,ssembler *"lasm.exe+ (enerates a .% file from 0icrosoft intermediate language *0-"1+. 5ou can run the resulting executable! which contains 0-"1 code and the re=uired metadata! to determine whether the 0-"1 code performs as expected. 0-"1 9isassembler *"ldasm.exe+ Takes a .% file that contains 0-"1 code and creates a text file suitable as input to the 0-"1 ,ssembler *"lasm.exe+. 3esource &ile (enerator Tool *3esgen.exe+ 'onverts text files and .resx */01-based resource format+ files to .$%T common language runtime binar .resources files that can be embedded in a runtime binar executable or compiled into satellite assemblies. Windows &orms ,ctive/ 'ontrol "mporter 'onverts t pe definitions in a '70 t pe *,ximp.exe+ librar for an ,ctive/ control into a Windows &orms control. Windows &orms 'lass 6iewer *Wincv.exe+ &inds managed classes matching a specified search pattern! and displa s information about those classes using the 3eflection ,.". Windows &orms 3esource %ditor ,llows ou to =uickl and easil locali#e *Winres.exe+ Windows &orms forms.

A"&.NET 'obile Controls

,-..$%T 0obile 'ontrols *formerl the 0icrosoft 0obile "nternet Toolkit+ extends the .$%T &ramework and 6isual -tudio .$%T b providing support for mobile *wireless+ devices such as cell phones and personal data assistants *.9,s+. The .$%T &ramework version 1.1 release incorporates the mobile controls into the .$%T &ramework and 6isual -tudio .$%T distributions. 8ecause mobile controls are now a part of the .$%T &ramework! the terminolog has changed to match the conventions used in .$%T documentation! and the mobile controls documentation has merged into the larger .$%T &ramework documentation set. The name 0obile "nternet Toolkit is replaced b ,-..$%T 0obile 'ontrols. ,-..$%T 0obile 'ontrols extend ,-..$%T server controls such that the adapt to the mobile device on which the Web application is rendering. Through browser detection! the mobile controls conform to the capabilities of individual devices ranging from fullfeatured .9, browsers to small! ?-line D 2:-character cell phone displa s. This adaptive rendering feature handles man of the tedious device-specific rendering decisions and frees ou to focus on our Web application logic.

Changes in A (.NET
The .$%T &ramework 9ata .rovider for 798'! which previousl was available as a Web download onl ! now ships with the .$%T &ramework under the namespace - stem.9ata.7dbc. Note 9evelopers using the .$%T &ramework version 1.: still must download the .$%T &ramework 9ata .rovider for 798' from httpE//msdn.microsoft.com/downloads *namespace F Microsoft.Data.Odbc+. The .$%T &ramework 9ata .rovider for 7racle now ships with the .$%T &ramework under the namespace System.Data.OracleClient. 9evelopers using the .$%T &ramework version 1.: can download the .$%T &ramework 9ata .rovider for 7racle from httpE//msdn.microsoft.com/downloads. "n addition! ,97.$%T now includes the following featuresE The Data eader object now exposes a !as ows propert to determine if rows were returned without having to call ead. &or more information! see 3etrieving 9ata )sing the 9ata3eader. The Connection object now has an "nlistDistrib#tedTransaction method to enable manual enlistment in distributed transactions. &or more information! see .erforming Transactions.

"i$e#by#"i$e Execution
The .$%T &ramework version 1.1 supports side-b -side execution. -ide-b -side execution is the abilit to store and execute multiple versions of an application or component on the same computer. This means that ou can have multiple versions of the runtime! and multiple versions of applications and components that use a version of the

runtime! on the same computer at the same time. "n addition! subse=uent installations of other versions of the .$%T &ramework or of a component will not affect the applications alread installed. &or more information! see -ide-b --ide %xecution. -ide-b -side execution does not impl that a managed application is compatible with other versions of the runtime or of a component. 3ather! it means that a managed application can choose the runtime and the components it executes with! and that multiple versions of the runtime! applications! and components can coexist on the same computer. "t is up to ou to decide which versions of the runtime and which components a particular application will use.

Changes in .NET Framework "ecurity


"n version 1.: and 1.1! applications that receive less than full trust from the runtime code access securit s stem cannot call shared managed libraries unless the librar writer specificall allows them to through the use of the ,llow.artiall Trusted'allers,ttribute attribute. "f ou plan on using libraries from partiall trusted code! ou need to be aware that some libraries will not be available to our code. "n version 1.1! - stem.Web.dll! - stem.Web.0obile.dll! and - stem.Web.3egular%xpressions.dll are included in the list of assemblies that have the Allow$artiallyTr#stedCallersAttrib#te and can be called from partiall trusted code. &or more information! see )sing 1ibraries from .artiall Trusted 'ode. 9efault securit polic has been changed so that applications executing from the "nternet #one and assigned to the %nternet &one code group now receive permissions associated with the %nternet permission set. ,s a result! applications from the "nternet now receive sufficient permission to execute. "n the .$%T &ramework 1.: -ervice .ack 1 and -ervice .ack 2! such applications received the permissions associated with the Not'in( permission set and could not execute. &or more information! see 9efault -ecurit .olic .

A"&.NET "ecurity in )oste$ En!ironments


,-..$%T now supports partial trust in Web-based applications! offering greater securit for multiple applications that are hosted on a single Web server. ,lthough the operating s stem account under which an application runs imposes securit restrictions on the application! the code access securit s stem of the common language runtime can enforce additional restrictions on selected application resources based on polic that ou specif . 5ou can use this feature in a shared server environment to isolate separate applications and with standalone servers where ou want applications to run with the minimum necessar privileges. ,-..$%T provides a GtrustH configuration directive that enables ou to configure code access securit levels for our applications. "f our partiall trusted ,-..$%T applications call shared managed libraries! those libraries must contain an ,llow.artiall Trusted'allers,ttribute attribute that allows calls from partiall trusted code. &or more information! see )sing 1ibraries from .artiall Trusted 'ode.

*&!+ "upport in the .NET Framework

The .$%T &ramework version 1.1 supports the emerging update to the "nternet .rotocol! commonl referred to as ". version I! or simpl ".vI. This protocol is designed to significantl increase the address space used to identif communication endpoints in the "nternet to accommodate its ongoing growth. ".vI is supported in the - stem.$et namespace! ,-..$%T! and /01 Web services. &or more information! see "nternet .rotocol 6ersion I.

You might also like