WCF Tracing Note
来源:互联网 发布:乌菲兹美术馆讲解软件 编辑:程序博客网 时间:2024/05/06 12:47
http://msdn.microsoft.com/en-us/library/aa751917.aspx
There are four components to WCF Diagnostics: Eventing,Tracing, which includes Activity Tracing, and Message Logging.
-Activities
-“areprocessing units that help the user narrow down the scope of a failure. Errorsthat occur in the same activity are directly related.”
-Code:
<sourcename="System.ServiceModel"switchValue="Verbose,ActivityTracing">
-Transfer:“Transfers between activities represent causal relationshipsbetween events inthe related activities within endpoints. Two activities are related with transfers when control flows between these activities, e.g., a method callcrossing activity boundaries.” In plain words, we can see transfers likerelationships between activities.
-Propagation
-Propagation provides the user with direct correlation of error traces for the same unit of processingacross application endpoints,even across application domains. This is done through propagation of the activity ID in the message headers.
-e.g:Errors emitted at different endpoints for the same unit of processing (forexample, a request) are grouped in the same activity,
-Activitypropagation is a configurable capability that causes WCF to add a header tooutbound messages, which includes the activity ID on the TLS.
**Activities,transfers, and propagation allow you to perform error correlation. In this way,you can find the root cause of an error more quickly.
**we can correlateactivities through transfers (within the same endpoint) and propagation (acrossendpoints)
**If thepropagateActivityattribute isset to true on both the client and service, theambient activity in the operation scope of the service is set by WCF.
http://msdn.microsoft.com/en-us/library/aa738759.aspx
Emitting User-Code Traces
-Code:
-Creatinga Trace Source:
TraceSource ts = new TraceSource("myUserTraceSource");
-CreatingActivities (Activities are logical unit of processing)
GuidoldID = Trace.CorrelationManager.ActivityId;
GuidtraceID = Guid.NewGuid();
ts.TraceTransfer(0,"transfer", traceID);
Trace.CorrelationManager.ActivityId= traceID; // Trace is static
ts.TraceEvent(TraceEventType.Start,0, "Add request");
-EmittingTraces within a User Activity
doublevalue1 = 100.00D;
doublevalue2 = 15.99D;
ts.TraceInformation("Clientsends message to Add " + value1 + ", " + value2);
doubleresult = client.Add(value1, value2);
ts.TraceInformation("Clientreceives Add response '" + result + "'");
-Stoppingthe Activities
-Tostop the activities,transfer back to the old activity, stop the current activity id, and reset the old activity id in scope.
ts.TraceTransfer(0,"transfer", oldID);
ts.TraceEvent(TraceEventType.Stop,0, "Add request");
Trace.CorrelationManager.ActivityId= oldID;
http://blog.csdn.net/quanben/article/details/5271298
端到端跟踪
活动(Activities)是WCF端到端跟踪中基本信息单元。
活动不是对象,而是WCF进行处理活动的一些节点。活动一般可以解释为:当X正在发生时,跟踪就产生。
为了实现端到端跟踪,在client和service的source的propagateActivity属性均需设置为true,这样一个跟踪就可以产生一个转移跟踪(Trace Transfer)。
用Guid.NewGuid()创建一个Guid对象
Trace.CorrelationManager.ActivityId用来设置当前活动的GUID。
ts.TraceTransfer(int eventId, string message, Guid relatedActivityId)用来发生转移,relatedActivityId为转入时为新的GUID,转回时为原GUID。
- WCF Tracing Note
- WCF + vs2005 Video Note
- Learning WCF - Security Note
- WCF的Message Logging 和Tracing
- WCF Addressing In Depth Note
- WCF Note9(Configuring Tracing, Microsoft Service Trace Viewer)
- New in WCF 4.0 Note & Filters for Message Logging Note
- Windows Communication Foundation (WCF) Firestarter Note
- WCF 4 Step By Step Chapter 1,2 Note
- WCF 4 Step By Step Chapter 3 Note (Fault Handling)
- WCF 4 Step By Step Chapter 9 Note (Transaction)
- WCF 4 Step By Step Chapter14 Note 1 (Discovering Services)
- WCF 4 Step By Step Chapter14 Note 2 (Routing Messages)
- WCF 4 Step By Step Chapter13 Note (Implementing a WCF Service for Good Performance)
- Code Tracing
- SQL Tracing
- Enabling Tracing
- Oops-tracing
- hdu 1133 卡特兰数的应用 java水大数
- WCF Before Call and After Call
- SQL Server 性能调优(一)——从等待状态判断系统资源瓶颈
- 用perl脚本发送带附件的邮件
- 站在视频教程网
- WCF Tracing Note
- C++ string详解
- dll工作原理《转》
- 昨天内部haskell freetalk的ppt和源码
- UVa Problem 10069 Distinct Subsequences
- 对于感情的语句
- haskell的世界观(1)
- 趣味记忆5大经典的软件架构风格
- haskell的世界观(2)