Title: Im berblick
1 Im Überblick
- Bearbeitet von Nicola Almukarker
- 03.02.2004
2Table of contents (1)
- What is .NET?
- .Net Framework
- Common Language Runtime (CLR)
- Base Class Library (BCL)
- what does .net bring?
3Table of contents (2)
- .Net Architecture
- virtual machine
- Common Type System (CTS)
- Common Language Specification (CLS)
- Common Intermediate Language (CIL)
- Codemanagement
- Assemblies and modules
- Security
4Table of contents (3)
- ASP.NET
- Production of dynamic web sites
- Web-Services
- Overlook
- Summary
5What is .NET? (1)
- Operating System?
- Server?
- Software product, Compiler?
- Programming Language?
- Protocols and technologies for the communication
between server and clients?
6What 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
7What is .NET? (3) Base Class Library
8What 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
9What is .NET? (5)
.NET Framework
ASP
MFC ATL
VB Forms
Windows API
10Agenda
- 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
11Virtual 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
12Virtual machine (2)
C
VB.NET
Oberon
Eiffel
- Compactness by IL-code instructions
- Optimized code by analyze the Operating systems
configuration
n m
Frontends
IL-Code
Backends
MacOS
PalmOS
Linux
Windows
13Virtual machine (3)
- CLR is the successor of COM
Typesystem Services for Distributed application
s Loader Remoting
Laguage-layer
Laguage-layer
Common Language Runtime
Microsoft Transaction Server
COM Runtime
COM Runtime
14Common 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
Arrays
Enumerations
Delegates
15Common Type System (CTS) (2)
.
MethodState
Heap
RPoint
x
Method execute
x
y
VPoint
y
MethodState
Heap
x
End of Method
y
16Common 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
17Common Type System (CTS) (4) Boxing Unboxing
Heap
MethodState
.
Obj x Stack
Obj x Stack
3
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
6
5
7
18Common Type System (CTS) (5)
- Predefined data types of the CLR
IL-Assembler CLR-name Description 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
19Common 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 LdstrHello!
Call vararg void AVarArgMethod(int32, ...,
int32, string)
- the Iterator system is effective on the further
Parameteren in the trunk of the method
20Common 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.ArgIteratorGetNextArg()
call object System.TypedReferenceToObject(typed
ref)
21Common Language Specification (CLS) (1)
CTS
Language A
CLS
Language C
Language B
22Common 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.Accessib
le()' is not CLS-compliant
Using System assembly CLSCompliant(true) Publi
c class VisibleType public sbyte
Accessible()...
CLSCompliant(false) public sbyte
Accessible()...
23Common Intermediate Language (CLS) (3)
- Operands 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
24Just in time Compilation (1)
VB.Net
C
C
Compiler
Compiler
Compiler
ASM Code
IL-Code
CLR
JIT Compiler
Operating system
25Just in time Compilation (2)
26Codemanagement (1)
Execution Engine (EE)
Thread 1 Thread 2 Thread 3 ...
. . .
List the method conditions
List the method conditions
Heap
27Codemanagement (2)
Previous condition
Safety features
Method description
arguments
Local variables
Local allocations
Instruction pointer
Operands stack and output parameters
28Codemanagement (3)
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
29Assemblies and modules (1)
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
30Assemblies 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
31Assemblies 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
32Assemblies and modules (4)
- Version
- Private Assemblies (in Applications 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
33Assemblies 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 value result
- 1.2.3.4 1.2.3.4
- - 0.0.0.0
- 1.2. 1.2.745.18000
- (on 15.1.2002 at 100000 h)
34Assemblies 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
35Assemblies and modules (7)
Assembly A
Assembly B
Ressource
Assembly C
Assembly D
p.Demand()
36ASP.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)
37ASP.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
38ASP.NET (3)
Using System.IO Public class CounterPage
System.Web.UI.Page int CounterValue()
FileStream s snew FileStream("c\\Data\\Co
unter.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
39ASP.NET (4)
Counter.aspx
lt _at_ Page Language"C" Inherits"CounterPage"
Src"CounterPage.cs" gt lthtmlgt ltheadgt
lttitlegtBesucherzaumlhlerlt/titlegt lt/headgt
ltbodygt lth1gtWillkommenlt/h1gt Sie sind der
ltCounterValue()gt. Besucher Dieser Seite!
lt/bodygt lt/htmlgt
40ASP.NET (5)
.NET Framework
Request Counter.aspx
Client (Web- Browser)
ASP .NET
Server (IIS)
Counter.aspx
Response .html
Counter.dat
41Web-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
42Web-Sevices (2)
UDDI
1. Registering
2. search
Web- Service A
Book Paradise
3. Connection
4. Get data
Web- Service B
43Web-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)
44Web-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
45Summary (1)
- What is .NET?
- virtual machine
- Common Type System (CTS)
- Common Language Specification (CLS)
- Common Intermediate Language (CIL)
- Codemanagement
46Summary (2)
- Assemblies and modules
- Security
- ASP.NET
- Production of dynamic web sites
- Web-Services
- heterogeneous distributed services
47Danke für die Aufmerksamkeit!