1 / 47

Im Überblick

Im Überblick. Bearbeitet von Nicola Almukarker 03.02.2004. Table of contents (1). „What is .NET?“ .Net Framework Common Language Runtime (CLR) Base Class Library (BCL) what does .net bring?. Table of contents (2). .Net Architecture virtual machine Common Type System (CTS)

Télécharger la présentation

Im Überblick

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Im Überblick Bearbeitet von Nicola Almukarker 03.02.2004

  2. Table of contents (1) • „What is .NET?“ • .Net Framework • Common Language Runtime (CLR) • Base Class Library (BCL) • what does .net bring?

  3. Table of contents (2) • .Net Architecture • virtual machine • Common Type System (CTS) • Common Language Specification (CLS) • Common Intermediate Language (CIL) • Codemanagement • Assemblies and modules • Security

  4. Table of contents (3) • ASP.NET • Production of dynamic web sites • Web-Services • Overlook • Summary

  5. What is .NET? (1) • Operating System? • Server? • Software product, Compiler? • Programming Language? • Protocols and technologies for the communication between server and clients?

  6. What is .NET? (2) Anwendung Base Class Library ... ASP.NET ADO.NET Web-Services Common Language Runtime Garbage Collection Just-in-Time Compilation Security ... Operating system

  7. What is .NET? (3) Base Class Library

  8. What is .NET? (4) • what does .net bring? • Robust software and Security • Verification of the CIL-Code • Security through Garbage Collector • Simple installation and deinstallation • Assemblies in own Directory or GAC • No need to register in the Windows-Registry • Uniform software for desktop and web

  9. What is .NET? (5) .NET Framework VB Forms MFC & ATL ASP Windows API

  10. Agenda • „What is .NET?“ • .Net Architecture • virtual machine • Common Type System (CTS) • Common Language Specification (CLS) • Common Intermediate Language (CIL) • Meta data • Assemblies and modules • Security

  11. Virtual machine (1) • A virtual machine for what? • SW-Procssor (Stackmachine) • reading and saving Operands & Operations • It works on IL-code and not native code • Platform and language independence n * m C# VB.NET Oberon Eiffel Windows Linux PalmOS MacOS

  12. Virtual machine (2) C# VB.NET Oberon Eiffel • Compactness by IL-code instructions • Optimized code by analyze the Operating system’s configuration n + m Frontends IL-Code Backends Windows Linux PalmOS MacOS

  13. Virtual machine (3) • CLR is the successor of COM Typesystem Services for Distributed applications Loader Remoting Laguage-layer Laguage-layer Common Language Runtime Microsoft Transaction Server COM+ Runtime COM Runtime

  14. Common Type System (CTS) (1) Value Types Reference Types Boxing Pointers Integers Managed Floating point num. unmanaged Bool values Methods- Strings Interfaces Typed Reference Classes Structs Enumerations Arrays Delegates

  15. Common Type System (CTS) (2) . MethodState Heap RPoint x Method execute x y VPoint y MethodState Heap x End of Method y

  16. Common Type System (CTS) (3) • Boxing & Unboxing (Example in C#) • object obj = 3 ; // Boxing • int x = (int) obj ; // Unboxing • .locals ( object obj, int32 x ) • // object obj = 3 ; • ldc.i4.3 • box System.Int32 • stloc obj • // int x = (int) obj ; • ldloc obj • unbox System.Int32 • ldind.i4 • stloc x

  17. Common Type System (CTS) (4) Boxing & Unboxing Heap MethodState . Obj x Stack 3 Obj x Stack Obj x Stack 1 2 . 3 3 3 . . . . Obj x Stack Obj x Stack Obj x Stack Obj x Stack . 3 3 3 3 3 3 4 5 6 7

  18. Common Type System (CTS) (5) • Predefined data types of the CLR IL-AssemblerCLR-nameDescription bool System.Boolean 1 Byte: 1-255 (true) char System.Char 16-Bit-Unicode-sign string System.String Unicode-String object System.Object managed Pointer on obj. typedref System.Typed- value type (Pointer and Reference type-Info for vararg) float32 System.Single 32 Bit numbers float64 System.Double 64 Bit numbers int8 System.Sbyte 8 Bit: [-128..127] int16 System.Int16 16 Bit: [-32768..32767]

  19. Common Type System (CTS) (6) • Call of a method with variable number of parameters .method static vararg void VarArgMethod(int32 x) {...} ldc.i4.1 ldc.i4.2 Ldstr“Hello!“ Call vararg void A::VarArgMethod(int32, ..., int32, string) -the Iterator system is effective on the further Parameteren in the trunk of the method

  20. Common Type System (CTS) (7) .locals init (valuetype System.ArgIterator iter) //The Iterator is laid out to this in a local variable on the stack ldloca iter arglist call instance void System.ArgIterator::.ctor(valuetype System.RuntimeArgumentHandle) // arglist produces a reference on the list of the optional //parameters which is submitted with the constructor of the Iterators ldloca iter call instance typedref System.ArgIterator::GetNextArg() call object System.TypedReference::ToObject(typedref)

  21. Common Language Specification (CLS) (1) CTS Language A CLS Language C Language B

  22. Common Language Specification (CLS) (2) • CLSCompliant: Attribute checks the CLS-conformity of the Assemblies • an Assembly must explicitly be conformed • Error CS3002: Return type of 'VisibleType.Accessible()' is not CLS-compliant Using System; [assembly: CLSCompliant(true)] Public class VisibleType{ public sbyte Accessible(){...} } [CLSCompliant(false)] public sbyte Accessible(){...}

  23. Common Intermediate Language (CLS) (3) • Operand’s Type-infromation in Java-Bytecode & CIL • (Example) Save the sum of the first 2 local variables in a third one J-Bytecode (Integer) J-Bytecode (Float) CIL (Integer or Float) iload_0 fload_0 ldloc.0 iload_1 fload_1 ldloc.1 iadd fadd add istore_2 fstore_2 stloc.2

  24. Just in time Compilation (1) VB.Net C# C++ Compiler Compiler Compiler ASM Code IL-Code CLR JIT Compiler Operating system

  25. Class A (1) Method call Method 1 (ASM) Class B Method 2 (IL) Methode 1 (IL) Method 1 (ASM) Method 3 (IL) Method 2 (IL) Method 4 (IL) JIT Compiler (2) Replacing IL code by native code Just in time Compilation (2)

  26. Codemanagement (1) • Memory administration Execution Engine (EE) Thread 1 Thread 2 Thread 3 ... . . . List the method conditions List the method conditions Heap

  27. Codemanagement (2) • Method conditions Previous condition Method description Safety features arguments Local variables Local allocations Instruction pointer Operands stack and output parameters

  28. Codemanagement (3) • Garbage Collector NextObjPtr Obj A Laying out objects on the Heap NextObjPtr Obj A Obj B newobj A::.ctor() newobj B::.ctor() Obj A Obj A Obj B Obj D Heap and Indicator before and after a GC Obj C Obj E GC Obj D Roots Roots Obj E Obj F NextObjPtr

  29. Assemblies and modules (1) • Meta data in PE-Files PE/COFF Headers CLR Header CLR Data .Net-PE-File Meta data IL-Code 1. a program which informs the user that this file isn't executable under DOS 2. CLR header saves version number of the CLR for which the program was written

  30. Assemblies and modules (2) • Module (managed module): .net-PE file is a module which contains the definition of types with Metadaten, the CIL code of the defined methods and a Manifest. • Manifest is in an exe file and has all information which is necessary to find all definitions of an Assembly. • Assembly manifest references files

  31. Assemblies and modules (3) • Assembly is a .Net-Component that Capsules, secures and versions modules MFAApp.exe Aim: PublicType .module MFAApp pub.mod OtherApp.exe Manifest .module pub.mod .module AnotherApp .assemblyMFAApp .file pub.mod .class extern public PublicType Meta data Manifest .assmbly extern mscorlib .class public PublicType .assembly OtherApp Meta data Meta data .assmbly extern mscorlib .modul extern pub.mod .class public App .assmbly extern mscorlib .assmbly extern MFAApp .class public App CIL-Code CIL-Code CIL-Code

  32. Assemblies and modules (4) • Version • Private Assemblies (in Application‘s directory) • Shared Assemblies (Global Assembly Cache) • StrongName: name of the Manifest module • Version: Major.Minor.Build.Revision • Culture • Public key 128 Byte to identify the producer

  33. Assemblies and modules (5) • Producing of version • In source code with the attribute System.Reflection.AssemblyVersionAttribute • By Assembly-Linker(al.exe) at the production of the Assembly • Examples Input valueresult • 1.2.3.4 1.2.3.4 • - 0.0.0.0 • 1.2.* 1.2.745.18000 (on 15.1.2002 at 10:00:00 h)

  34. Assemblies and modules (6) • Roll based security • code based security • fixing the access rights of an assembley to the load time • Security stack walk Assembly A Policy Levels Assembly A Enterprise Machine Evidence User PermissionSet ... Application Domain Hash Site Zone FileIO IsolatedStorage ... Security Manager Registry StrongName Reflection

  35. Assemblies and modules (7) • Security stack walk Assembly A Assembly B Ressource Assembly C Assembly D p.Demand()

  36. ASP.NET (1) • Technology for web applications • Web Forms and dynamic web pages by servers scripts • object orientation (aspx-page) • Web controls: GUI-objects • separation from layout and application logic (.aspx and source code .cs)

  37. ASP.NET (2) • component orientation (events) • Interactive lay-out of web pages • Compilation instead of interpretation • Improve administration of the page condition, • Dynamic ASPX Page • Simple example: a page with visitor counter

  38. ASP.NET (3) Using System.IO; Public class CounterPage : System.Web.UI.Page{ int CounterValue(){ FileStream s; s=new FileStream("c:\\Data\\Counter.dat", FileMode.OpenOrCreate); int n; try{ BinaryReader r = new BinaryReader(s); n = r.ReadInt32(); } catch { n = 0;} n++; s.Seek(0,SeekOrigin.Begin); BinaryWriter w = new BinaryWriter(s); w.Write(n); s.Close(); return n; } } CounterPage.cs

  39. ASP.NET (4) Counter.aspx <% @ Page Language="C#" Inherits="CounterPage" Src="CounterPage.cs" %> <html> <head> <title>Besucherz&auml;hler</title> </head> <body> <h1>Willkommen</h1> Sie sind der <%=CounterValue()%>. Besucher Dieser Seite! </body> </html>

  40. ASP.NET (5) .NET Framework Request Counter.aspx Client (Web- Browser) ASP .NET Server (IIS) Counter.aspx Response *.html Counter.dat

  41. Web-Sevices (1) • heterogeneous distributed services • they are independent of the operating system, Programming language and binary transfer protocol • XML based protocol [SOAP] • [WSDL] earlier IDL of DCOM • IIS passes on soap calls to the corresponding web-service-implementation, produces objects and/or deletes them

  42. Web-Sevices (2) UDDI 1. Registering 2. search Web- Service A Book Paradise 3. Connection 4. Get data Web- Service B

  43. Web-Sevices (3) • My Services: Address book, calendar, mailbox, ... • Microsoft .Net Alerts-Services for PC, Smart devices etc... • Transfer via Binary protokol with sockets or .Net Remoting and not TCP/IP (limited)

  44. Web-Sevices (4) • Namespaces for Web-Services • System.Web.Services (creates web services) • System.Web.Services.Configuration (configures xml description) • System.Web.Services.Description (classes for WSDL) • System.Web.Services.Discovery • System.Web.Services.Protokols

  45. Summary (1) • „What is .NET?“ • virtual machine • Common Type System (CTS) • Common Language Specification (CLS) • Common Intermediate Language (CIL) • Codemanagement

  46. Summary (2) • Assemblies and modules • Security • ASP.NET • Production of dynamic web sites • Web-Services • heterogeneous distributed services

  47. Danke für die Aufmerksamkeit!

More Related