SlideShare uma empresa Scribd logo
1 de 46
ASP.NET 2.0  安全機制與偵錯 ( 下集 ) 曹祖聖 台灣微軟資深講師 [email_address] http://teacher.allok.com.tw MCP, MCP+I, MCSA, MCSE, MCDBA, MCAD, MCSD, MCT, MVP
講師簡介 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
講師簡介 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
執行時期監控 優點  ? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
效能計數器 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
使用  ASP.NET 2.0  效能計數器
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Windows  事件追蹤 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Windows  事件追蹤 追蹤元件 事件提供者   C 事件提供者   B 事件提供者  A 事件記錄檔 事件控制 … Consumer 即時事件 已記錄事件 Session 1 暫存區 Session 2 Session 64 追蹤的  Session 事件 事件 啟動  /  停用 Session  控制 事件處理
事件看起來像  ? ,[object Object],[object Object],4 Bytes ULONG  Kernel mode CPU Time (Ticks) KernelTime 4 Bytes ULONG User mode CPU Time (Ticks) UserTime 4 Bytes Handle Thread responsible for event ThreadId 4 Bytes Handle Process responsible for event ProcessId 8 Bytes Quad Integer Wall Clock Type (100 ns) TimeStamp 1 Byte UCHAR Event Level Level 1 Byte UCHAR Event Type Type 2 Bytes USHORT Version of record Version 16 Bytes GUID Globally unique identifier GUID 4 Bytes ULONG Event record size  Size
Windows  事件追蹤 使用追蹤 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ASP.NET  追蹤事件 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
記錄追蹤狀態 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
檢視追蹤資料 ,[object Object],[object Object],[object Object],[object Object]
Windows  事件追蹤
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
執行時期輸出偵錯資訊 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
啟動  ASP.NET  追蹤 ,[object Object],[object Object],<trace enabled=&quot;true&quot; pageOutput=&quot;true“ localOnly=&quot;true&quot;/> <%@ Page Language=&quot;vb&quot; Trace=&quot;true&quot; %>   <%@ Page Language=&quot;c#&quot; Trace=&quot;true&quot; %>
使用  Trace  物件 ,[object Object],[object Object],[object Object],Trace.Write (&quot; category &quot;, &quot; message &quot;) Trace.Warn (&quot; category &quot;, &quot; message &quot;) If Trace.IsEnabled Then strMsg = &quot;Tracing is enabled!&quot; Trace.Write(&quot;myTrace&quot;, strMsg) End If Trace.IsEnabled = False
直接在頁面中檢視追蹤結果
使用應用程式層級追蹤 ,[object Object],http://server/project/trace.axd 頁面 Trace=True Trace=False - 應用程式 - - Trace=True 結果 ,[object Object],[object Object],[object Object]
使用  ASP.NET Trace  功能
元件追蹤 ,[object Object],[object Object],[object Object],HttpContext.Current.Trace.IsEnabled = True Imports System.Web HttpContext.Current.Trace.Write _ (“ 類別名稱” , “ 訊息 &quot;)
元件追蹤
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
.NET  應用程式執行流程  ( 一 ) + 組件  (Assembly 、 IL) Metadata Resources Intermediate Language Compiler ( 中間碼編譯器 ) Just-In-Time Compiler ( 即時編譯器 ) Class Library ( 類別程式庫 ) + + Assembly Loader ( 組件載入器 ) Class Loader ( 類別載入器 ) Security ( 安全性檢查 ) Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group  grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group  grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable(&quot;USERNAME&quot;); f=new FileStream(“C:est.txt&quot;,FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine(&quot;Exception:&quot;+e.ToString()); } } 程式原始碼 + 機器碼  (Native Code)
.NET  應用程式執行流程  ( 二 ) Native Code Manager ( 程式管理員 ) 執行 Garbage Collection ( 垃圾收集 ) Exception Manager ( 例外管理員 ) Thread Support ( 執行緒支援 ) COM Interop (COM 元件整合 ) Debug Engine ( 偵錯引擎 ) Native Code Cache ( 機器碼快取 ) Security ( 安全性檢查 ) Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group  grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group  grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; + 機器碼  (Native Code)
ASP.NET  遠端偵錯 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ASP.NET  遠端偵錯
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
ASP .NET  處理模型 IIS 5.0 TCP/IP WinSock 2.0 inetinfo.exe aspnet_isapi.dll Metabase FTP, SMTP, NNTP aspnet_wp.exe User Mode Kernel Mode Request Response named pipes Request Response 工作行程的啟動帳號 : ASPNET aspnet_wp.exe HTTP runtime App Domain App Domain
ASP .NET  執行時期  Attributes ,[object Object],[object Object],Local Request  所佔用的最小執行緒數目 minLocalRequestFreeThreads Request  所佔用的最小執行緒數目 minFreeThreads 最大  Request  大小 maxRequestLength Request  最長執行時間 executionTimeout ASP .NET Request  佇列大小 appRequestQueueLimit 說明 Attribute  名稱
Health Monitoring ,[object Object],[object Object],[object Object],[object Object],[object Object]
Health Monitoring ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ASP .NET  處理模型 IIS 6.0 TCP/IP HTTP.SYS inetinfo.exe Metabase FTP, SMTP, NNTP w3wp.exe User Mode Kernel Mode Request Response WAS App Pool Mgr. Cording Mgr. aspnet_isapi.dll w3wp.exe aspnet_isapi.dll Response Request 工作行程的啟動帳號 : NETWORK SERVICE
IIS 6.0  處理模型 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Orphaning Failed  工作行程 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
偵錯記憶體相關問題 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
垃圾收集機制 ,[object Object],Garbage Collection 已配置空間 已釋放空間 已配置空間 已配置空間
記憶體  Generations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Large Object Heap ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
應用程式集區設定
大綱 ,[object Object],[object Object],[object Object],[object Object],[object Object]
總結 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
© 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Mais conteúdo relacionado

Mais procurados

Memcached 剖析
Memcached 剖析Memcached 剖析
Memcached 剖析litaocheng
 
136 Ch
136 Ch136 Ch
136 Chanjaan
 
JSplash swf to javascript converter(2008/9/30)
JSplash swf to javascript converter(2008/9/30)JSplash swf to javascript converter(2008/9/30)
JSplash swf to javascript converter(2008/9/30)gyuque
 
Inside the Erlang Vm
Inside the Erlang VmInside the Erlang Vm
Inside the Erlang VmFeng Yu
 
章文嵩:使用LVS集群架设高可扩展的网络服务.pdf
章文嵩:使用LVS集群架设高可扩展的网络服务.pdf章文嵩:使用LVS集群架设高可扩展的网络服务.pdf
章文嵩:使用LVS集群架设高可扩展的网络服务.pdfXMourinho
 
DS-026-知識管理的導入策略與步驟
DS-026-知識管理的導入策略與步驟DS-026-知識管理的導入策略與步驟
DS-026-知識管理的導入策略與步驟handbook
 
DS-033-裕隆日產汽車知識管理之路
DS-033-裕隆日產汽車知識管理之路DS-033-裕隆日產汽車知識管理之路
DS-033-裕隆日產汽車知識管理之路handbook
 
Architect Dec By Infoq
Architect  Dec By InfoqArchitect  Dec By Infoq
Architect Dec By Infoqliu qiang
 
JRuby在Rails中的应用
JRuby在Rails中的应用JRuby在Rails中的应用
JRuby在Rails中的应用crazycode t
 
256 Ch
256 Ch256 Ch
256 Chanjaan
 
Jitaku Server 3points
Jitaku Server 3pointsJitaku Server 3points
Jitaku Server 3pointsakitsukada
 
Overview of Open Application Platforms (Korean)
Overview of Open Application Platforms (Korean)Overview of Open Application Platforms (Korean)
Overview of Open Application Platforms (Korean)Channy Yun
 
変わる時代、変わらぬ思い
変わる時代、変わらぬ思い変わる時代、変わらぬ思い
変わる時代、変わらぬ思いHiromu Shioya
 
JavaScriptでオブジェクト指向(Javascript/OOP)
JavaScriptでオブジェクト指向(Javascript/OOP)JavaScriptでオブジェクト指向(Javascript/OOP)
JavaScriptでオブジェクト指向(Javascript/OOP)smzk
 

Mais procurados (20)

Memcached 剖析
Memcached 剖析Memcached 剖析
Memcached 剖析
 
136 Ch
136 Ch136 Ch
136 Ch
 
JSplash swf to javascript converter(2008/9/30)
JSplash swf to javascript converter(2008/9/30)JSplash swf to javascript converter(2008/9/30)
JSplash swf to javascript converter(2008/9/30)
 
Inside the Erlang Vm
Inside the Erlang VmInside the Erlang Vm
Inside the Erlang Vm
 
章文嵩:使用LVS集群架设高可扩展的网络服务.pdf
章文嵩:使用LVS集群架设高可扩展的网络服务.pdf章文嵩:使用LVS集群架设高可扩展的网络服务.pdf
章文嵩:使用LVS集群架设高可扩展的网络服务.pdf
 
DS-026-知識管理的導入策略與步驟
DS-026-知識管理的導入策略與步驟DS-026-知識管理的導入策略與步驟
DS-026-知識管理的導入策略與步驟
 
Codigo de unidades
Codigo de unidadesCodigo de unidades
Codigo de unidades
 
DS-033-裕隆日產汽車知識管理之路
DS-033-裕隆日產汽車知識管理之路DS-033-裕隆日產汽車知識管理之路
DS-033-裕隆日產汽車知識管理之路
 
Intro. to CSS
Intro. to CSSIntro. to CSS
Intro. to CSS
 
Architect Dec By Infoq
Architect  Dec By InfoqArchitect  Dec By Infoq
Architect Dec By Infoq
 
JRuby在Rails中的应用
JRuby在Rails中的应用JRuby在Rails中的应用
JRuby在Rails中的应用
 
Choi LINQ
Choi LINQChoi LINQ
Choi LINQ
 
256 Ch
256 Ch256 Ch
256 Ch
 
just a test
just a testjust a test
just a test
 
Jitaku Server 3points
Jitaku Server 3pointsJitaku Server 3points
Jitaku Server 3points
 
Stipa 1000sp
Stipa 1000spStipa 1000sp
Stipa 1000sp
 
Overview of Open Application Platforms (Korean)
Overview of Open Application Platforms (Korean)Overview of Open Application Platforms (Korean)
Overview of Open Application Platforms (Korean)
 
変わる時代、変わらぬ思い
変わる時代、変わらぬ思い変わる時代、変わらぬ思い
変わる時代、変わらぬ思い
 
JavaScriptでオブジェクト指向(Javascript/OOP)
JavaScriptでオブジェクト指向(Javascript/OOP)JavaScriptでオブジェクト指向(Javascript/OOP)
JavaScriptでオブジェクト指向(Javascript/OOP)
 
Tailieu Hs2005
Tailieu Hs2005Tailieu Hs2005
Tailieu Hs2005
 

Destaque

非常優的幾則短故事
非常優的幾則短故事非常優的幾則短故事
非常優的幾則短故事Chui-Wen Chiu
 
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)Windows 7兼容性系列课程(4):有针对的兼容性开发(下)
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)Chui-Wen Chiu
 
教你如何把Dvd轉成Avi檔,完整教學
教你如何把Dvd轉成Avi檔,完整教學教你如何把Dvd轉成Avi檔,完整教學
教你如何把Dvd轉成Avi檔,完整教學Chui-Wen Chiu
 
介紹如何在微軟新一代服務平台建立雲端運用程式
介紹如何在微軟新一代服務平台建立雲端運用程式介紹如何在微軟新一代服務平台建立雲端運用程式
介紹如何在微軟新一代服務平台建立雲端運用程式Chui-Wen Chiu
 
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?10.如何取消電腦開機的啟動選單並直接開機進入系統裡?
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?Chui-Wen Chiu
 
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識Chui-Wen Chiu
 
18.電腦機殼的選購及建議
18.電腦機殼的選購及建議18.電腦機殼的選購及建議
18.電腦機殼的選購及建議Chui-Wen Chiu
 
這一生都是你的機會
這一生都是你的機會這一生都是你的機會
這一生都是你的機會Chui-Wen Chiu
 
Silverlight Deployment Guide V2
Silverlight Deployment Guide V2Silverlight Deployment Guide V2
Silverlight Deployment Guide V2Chui-Wen Chiu
 
用喜樂彩繪人生
用喜樂彩繪人生用喜樂彩繪人生
用喜樂彩繪人生Chui-Wen Chiu
 

Destaque (17)

Auo
AuoAuo
Auo
 
非常優的幾則短故事
非常優的幾則短故事非常優的幾則短故事
非常優的幾則短故事
 
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)Windows 7兼容性系列课程(4):有针对的兼容性开发(下)
Windows 7兼容性系列课程(4):有针对的兼容性开发(下)
 
教你如何把Dvd轉成Avi檔,完整教學
教你如何把Dvd轉成Avi檔,完整教學教你如何把Dvd轉成Avi檔,完整教學
教你如何把Dvd轉成Avi檔,完整教學
 
介紹如何在微軟新一代服務平台建立雲端運用程式
介紹如何在微軟新一代服務平台建立雲端運用程式介紹如何在微軟新一代服務平台建立雲端運用程式
介紹如何在微軟新一代服務平台建立雲端運用程式
 
VB.NET 編碼準則
VB.NET 編碼準則VB.NET 編碼準則
VB.NET 編碼準則
 
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?10.如何取消電腦開機的啟動選單並直接開機進入系統裡?
10.如何取消電腦開機的啟動選單並直接開機進入系統裡?
 
排隊的店
排隊的店排隊的店
排隊的店
 
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識
資料庫開發可以更容易、更寬廣 - 談 SQL Server 2008 資料庫開發新知識
 
18.電腦機殼的選購及建議
18.電腦機殼的選購及建議18.電腦機殼的選購及建議
18.電腦機殼的選購及建議
 
十大完美照片
十大完美照片十大完美照片
十大完美照片
 
這一生都是你的機會
這一生都是你的機會這一生都是你的機會
這一生都是你的機會
 
Bw1096
Bw1096Bw1096
Bw1096
 
Silverlight Deployment Guide V2
Silverlight Deployment Guide V2Silverlight Deployment Guide V2
Silverlight Deployment Guide V2
 
用喜樂彩繪人生
用喜樂彩繪人生用喜樂彩繪人生
用喜樂彩繪人生
 
Borland傳奇
Borland傳奇Borland傳奇
Borland傳奇
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
 

Mais de Chui-Wen Chiu

高雄新地標 統一夢世代
高雄新地標  統一夢世代高雄新地標  統一夢世代
高雄新地標 統一夢世代Chui-Wen Chiu
 
天下第一 夜市總冠軍
天下第一 夜市總冠軍天下第一 夜市總冠軍
天下第一 夜市總冠軍Chui-Wen Chiu
 
下班就跑是富有哲學道理1
下班就跑是富有哲學道理1下班就跑是富有哲學道理1
下班就跑是富有哲學道理1Chui-Wen Chiu
 
柬埔寨鄉村婚禮
柬埔寨鄉村婚禮柬埔寨鄉村婚禮
柬埔寨鄉村婚禮Chui-Wen Chiu
 
挖好屬於自己的井
挖好屬於自己的井挖好屬於自己的井
挖好屬於自己的井Chui-Wen Chiu
 
Why The Us Wants War 080702
Why The Us Wants War  080702Why The Us Wants War  080702
Why The Us Wants War 080702Chui-Wen Chiu
 
你今天的選擇是什麼?
你今天的選擇是什麼?你今天的選擇是什麼?
你今天的選擇是什麼?Chui-Wen Chiu
 
我的學思歷程 劉兆玄
我的學思歷程 劉兆玄我的學思歷程 劉兆玄
我的學思歷程 劉兆玄Chui-Wen Chiu
 
Unknown Parameter Value
Unknown Parameter ValueUnknown Parameter Value
Unknown Parameter ValueChui-Wen Chiu
 

Mais de Chui-Wen Chiu (20)

Pythonpresent
PythonpresentPythonpresent
Pythonpresent
 
Introduce Django
Introduce DjangoIntroduce Django
Introduce Django
 
移動內存算法
移動內存算法移動內存算法
移動內存算法
 
墾丁 更新版
墾丁  更新版墾丁  更新版
墾丁 更新版
 
墾丁 更新版2
墾丁  更新版2墾丁  更新版2
墾丁 更新版2
 
高雄新地標 統一夢世代
高雄新地標  統一夢世代高雄新地標  統一夢世代
高雄新地標 統一夢世代
 
Python 庫簡介
Python 庫簡介Python 庫簡介
Python 庫簡介
 
Asp.Net Mvc 1.0
Asp.Net Mvc 1.0Asp.Net Mvc 1.0
Asp.Net Mvc 1.0
 
天下第一 夜市總冠軍
天下第一 夜市總冠軍天下第一 夜市總冠軍
天下第一 夜市總冠軍
 
下班就跑是富有哲學道理1
下班就跑是富有哲學道理1下班就跑是富有哲學道理1
下班就跑是富有哲學道理1
 
認識腸病毒
認識腸病毒認識腸病毒
認識腸病毒
 
柬埔寨鄉村婚禮
柬埔寨鄉村婚禮柬埔寨鄉村婚禮
柬埔寨鄉村婚禮
 
新 創 意
新 創 意新 創 意
新 創 意
 
挖好屬於自己的井
挖好屬於自己的井挖好屬於自己的井
挖好屬於自己的井
 
Why The Us Wants War 080702
Why The Us Wants War  080702Why The Us Wants War  080702
Why The Us Wants War 080702
 
你今天的選擇是什麼?
你今天的選擇是什麼?你今天的選擇是什麼?
你今天的選擇是什麼?
 
我的學思歷程 劉兆玄
我的學思歷程 劉兆玄我的學思歷程 劉兆玄
我的學思歷程 劉兆玄
 
Unknown Parameter Value
Unknown Parameter ValueUnknown Parameter Value
Unknown Parameter Value
 
你也在井裡嗎
你也在井裡嗎你也在井裡嗎
你也在井裡嗎
 
世界是平的
世界是平的世界是平的
世界是平的
 

Asp .Net 2.0 安全機制 Ii

  • 1. ASP.NET 2.0 安全機制與偵錯 ( 下集 ) 曹祖聖 台灣微軟資深講師 [email_address] http://teacher.allok.com.tw MCP, MCP+I, MCSA, MCSE, MCDBA, MCAD, MCSD, MCT, MVP
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. 使用 ASP.NET 2.0 效能計數器
  • 8.
  • 9.
  • 10. Windows 事件追蹤 追蹤元件 事件提供者 C 事件提供者 B 事件提供者 A 事件記錄檔 事件控制 … Consumer 即時事件 已記錄事件 Session 1 暫存區 Session 2 Session 64 追蹤的 Session 事件 事件 啟動 / 停用 Session 控制 事件處理
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 17.
  • 18.
  • 19.
  • 20.
  • 22.
  • 23. 使用 ASP.NET Trace 功能
  • 24.
  • 26.
  • 27. .NET 應用程式執行流程 ( 一 ) + 組件 (Assembly 、 IL) Metadata Resources Intermediate Language Compiler ( 中間碼編譯器 ) Just-In-Time Compiler ( 即時編譯器 ) Class Library ( 類別程式庫 ) + + Assembly Loader ( 組件載入器 ) Class Loader ( 類別載入器 ) Security ( 安全性檢查 ) Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; public static void Main(String[] args ) { String usr; FileStream f; StreamWriter w; try { usr=Environment.GetEnvironmentVariable(&quot;USERNAME&quot;); f=new FileStream(“C:est.txt&quot;,FileMode.Create); w=new StreamWriter(f); w.WriteLine(usr); w.Close(); } catch (Exception e){ Console.WriteLine(&quot;Exception:&quot;+e.ToString()); } } 程式原始碼 + 機器碼 (Native Code)
  • 28. .NET 應用程式執行流程 ( 二 ) Native Code Manager ( 程式管理員 ) 執行 Garbage Collection ( 垃圾收集 ) Exception Manager ( 例外管理員 ) Thread Support ( 執行緒支援 ) COM Interop (COM 元件整合 ) Debug Engine ( 偵錯引擎 ) Native Code Cache ( 機器碼快取 ) Security ( 安全性檢查 ) Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; Policy <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration> <mscorlib> <security> <policy> <PolicyLevel version=&quot;1&quot;> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;Nothing&quot; Name=&quot;All_Code&quot; Description=&quot;Code group grants no permissio ns and forms the root of the code group tree.&quot;> <IMembershipCondition clas s=&quot;AllMembershipCondition&quot; version=&quot;1&quot;/> <CodeGroup class=&quot;UnionCodeGroup&quot; version=&quot;1&quot; PermissionSetName=&quot;FullTrust&quot; + 機器碼 (Native Code)
  • 29.
  • 31.
  • 32. ASP .NET 處理模型 IIS 5.0 TCP/IP WinSock 2.0 inetinfo.exe aspnet_isapi.dll Metabase FTP, SMTP, NNTP aspnet_wp.exe User Mode Kernel Mode Request Response named pipes Request Response 工作行程的啟動帳號 : ASPNET aspnet_wp.exe HTTP runtime App Domain App Domain
  • 33.
  • 34.
  • 35.
  • 36. ASP .NET 處理模型 IIS 6.0 TCP/IP HTTP.SYS inetinfo.exe Metabase FTP, SMTP, NNTP w3wp.exe User Mode Kernel Mode Request Response WAS App Pool Mgr. Cording Mgr. aspnet_isapi.dll w3wp.exe aspnet_isapi.dll Response Request 工作行程的啟動帳號 : NETWORK SERVICE
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 44.
  • 45.
  • 46. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Notas do Editor

  1. Demo: diagnose a performance problem using perf counters We’ll start with an application under load that over allocates and show high allocation rates, % time in GC, and low RPS We’ll refine the app and reevaluate perf data, making incremental improvements that show improvements in key metrics
  2. Walkthrough defining and starting a trace session Make a couple of requests and stop trace session Walk through consuming trace session and walk through request flow and timings
  3. Walkthrough defining and starting a trace session Make a couple of requests and stop trace session Walk through consuming trace session and walk through request flow and timings
  4. Walkthrough defining and starting a trace session Make a couple of requests and stop trace session Walk through consuming trace session and walk through request flow and timings
  5. Write a reusable component that uses System.Diagnostics.Trace Show how that component works in a console application Configure the ASP.NET trace listener Use component in a web application and show how output goes to multiple listeners (e.g. ASP.NET page output and debug viewer)
  6. Write a reusable component that uses System.Diagnostics.Trace Show how that component works in a console application Configure the ASP.NET trace listener Use component in a web application and show how output goes to multiple listeners (e.g. ASP.NET page output and debug viewer)
  7. © 2003-2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 09/01/09 15:24