c# gtin Lesson 2: How to Debug a Remoting Application in Visual C#.NET

Printing EAN13 in Visual C#.NET Lesson 2: How to Debug a Remoting Application

Lesson 2: How to Debug a Remoting Application
EAN / UCC - 13 Maker In Visual C#.NET
Using Barcode drawer for Visual Studio .NET Control to generate, create EAN13 image in .NET framework applications.
www.OnBarcode.com
EAN / UCC - 13 Decoder In C#
Using Barcode reader for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Figure 6-10 The Windows Performance Monitor Add Counters dialog box
Generate Bar Code In Visual C#.NET
Using Barcode generation for VS .NET Control to generate, create bar code image in .NET framework applications.
www.OnBarcode.com
Recognizing Barcode In C#.NET
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
The counters included in the .NET Framework for tracking .NET remoting operations are described in Table 6-2.
European Article Number 13 Maker In Visual Studio .NET
Using Barcode creation for ASP.NET Control to generate, create EAN13 image in ASP.NET applications.
www.OnBarcode.com
EAN13 Generator In .NET Framework
Using Barcode printer for .NET Control to generate, create EAN 13 image in .NET framework applications.
www.OnBarcode.com
Table 6-2
EAN 13 Creation In VB.NET
Using Barcode creator for VS .NET Control to generate, create GTIN - 13 image in Visual Studio .NET applications.
www.OnBarcode.com
Create UPC-A In Visual C#.NET
Using Barcode encoder for .NET framework Control to generate, create UPC A image in .NET applications.
www.OnBarcode.com
.NET Remoting Performance Counters
Encode UCC-128 In C#
Using Barcode creator for .NET framework Control to generate, create UCC - 12 image in VS .NET applications.
www.OnBarcode.com
2D Barcode Creation In C#
Using Barcode drawer for .NET framework Control to generate, create 2D Barcode image in VS .NET applications.
www.OnBarcode.com
Counter Channels
Barcode Encoder In C#.NET
Using Barcode drawer for .NET framework Control to generate, create bar code image in .NET framework applications.
www.OnBarcode.com
ANSI/AIM ITF 25 Printer In C#.NET
Using Barcode printer for Visual Studio .NET Control to generate, create ANSI/AIM I-2/5 image in .NET applications.
www.OnBarcode.com
Description This counter tracks the total number of chan nels registered across all application domains for a particular application. This counter tracks the total number of proxies created in a particular process. This counter tracks the current number of context-bound classes that are loaded. This counter tracks the current number of context-bound objects allocated per second. This counter tracks the current number of con texts in a particular application.
EAN / UCC - 13 Creation In None
Using Barcode printer for Online Control to generate, create EAN13 image in Online applications.
www.OnBarcode.com
Generating ECC200 In Visual Basic .NET
Using Barcode generation for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in .NET framework applications.
www.OnBarcode.com
Context Proxies Context-Bound Classes Loaded Context-Bound Objects Alloc/sec Contexts
Generate Code 39 Full ASCII In None
Using Barcode creation for Office Excel Control to generate, create Code 3/9 image in Office Excel applications.
www.OnBarcode.com
Read PDF-417 2d Barcode In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
6
Matrix Barcode Printer In Visual Basic .NET
Using Barcode creation for .NET Control to generate, create 2D Barcode image in .NET framework applications.
www.OnBarcode.com
Making USS Code 128 In Java
Using Barcode creator for Android Control to generate, create Code 128A image in Android applications.
www.OnBarcode.com
Debugging and Deploying Remote Applications
Print Code 39 In Objective-C
Using Barcode encoder for iPhone Control to generate, create Code 39 Extended image in iPhone applications.
www.OnBarcode.com
Bar Code Creator In Java
Using Barcode creator for Android Control to generate, create barcode image in Android applications.
www.OnBarcode.com
Table 6-2
.NET Remoting Performance Counters
Counter Remote Calls/sec
Description This counter tracks the current number of remote procedure calls (RPC) invoked per second. This counter tracks the total number of RPCs invoked for a particular application.
Total Remote Calls
MORE INFO
Performance counters in the .NET Framework
For more information on performance counters, visit the topic titled Performance Counters in the .NET Framework at http://msdn2.microsoft.com/en-us/library/w8f5kw2e.aspx.
.NET Remoting Tracking Services
Although performance counters are extremely useful, the .NET Framework includes .NET remoting tracking services to provide more granular control to define custom behavior each time a .NET remoting operation is performed. The tracking services are located in the System.Runtime.Remoting.Services namespace. There are basically two facets involved in utilizing the .NET remoting tracking services: the TrackingServices class and the ITrackingHandler interface. The TrackingServices class is used to register user-defined classes with the remoting system. The user-defined classes implement the ITrackingHandler interface and are notified when particular remoting operations occur. The TrackingServices class includes the two methods described in Table 6-3 for managing user-defined classes that implement ITrackingHandler.
Table 6-3
TrackingServices Methods
Method RegisterTrackingHandler
Description This method is used to register a user-defined class with the remoting services as a class that should be notified when remoting operations occur. This method is used to unregister a user-defined class that is currently registered with the remoting services.
UnregisterTrackingHandler
Lesson 2: How to Debug a Remoting Application
To utilize tracking services, one or more user-defined classes are created that imple ment the ITrackingHandler interface. The ITrackingHandler interface includes three methods, as described in Table 6-4. These methods are called on all registered classes when the associated operation occurs.
Table 6-4
ITrackingHandler Methods
Method DisconnectedObject MarshaledObject UnmarshaledObject
Description This method is called when an object is disconnected from its proxy. This method is called when an object is marshaled. This method is called when an object is unmarshaled.
The following code example illustrates a user-defined class that implements ITrackingHandler and simply writes to the console when remoting operations are performed.
ITrackingHandler Interface Implementation
'VB Imports Imports Imports Imports System System.Runtime System.Runtime.Remoting System.Runtime.Remoting.Services
Namespace MSLearning.6.Server Class Tracker
Implements ITrackingHandler
Public Sub DisconnectedObject(ByVal obj As Object) Implements _
System.Runtime.Remoting.Services.ITrackingHandler.DisconnectedObject
Console.WriteLine("Object disconnected...")
End Sub
Public Sub MarshaledObject(ByVal obj As Object, _ ByVal [or] As System.Runtime.Remoting.ObjRef) Implements _ System.Runtime.Remoting.Services.ITrackingHandler.MarshaledObject Console.WriteLine("Object marshaled...")
End Sub
Public Sub UnmarshaledObject(ByVal obj As Object, _ ByVal [or] As System.Runtime.Remoting.ObjRef) Implements _ System.Runtime.Remoting.Services.ITrackingHandler.UnmarshaledObject
6
Debugging and Deploying Remote Applications
Console.WriteLine("Object unmarshaled...")
End Sub
End Class
End Namespace
//C# using using using using
System;
System.Runtime;
System.Runtime.Remoting;
System.Runtime.Remoting.Services;
namespace MSLearning.6.Server {
class Tracker : ITrackingHandler
#region ITrackingHandler Members public void DisconnectedObject(object obj)
Console.WriteLine("Object disconnected...");
public void MarshaledObject(object obj, ObjRef or) { Console.WriteLine("Object marshaled...");
public void UnmarshaledObject(object obj, ObjRef or) { Console.WriteLine("Object unmarshaled...");
#endregion
After a class is created that implements the ITrackingHandler interface, it can be regis tered to be notified when remoting operations occur using the TrackingServices class as shown in the following code example.
TrackingServices Class
'VB Imports Imports Imports Imports Imports System
System.Runtime.Remoting
System.Runtime.Remoting.Channels
System.Runtime.Remoting.Channels.Tcp
System.Runtime.Remoting.Services
Lesson 2: How to Debug a Remoting Application
Namespace MSLearning.6.Server Class Program Shared Sub Main() RemotingConfiguration.Configure( _ "StandardServer.exe.config", False) TrackingServices.RegisterTrackingHandler(New Tracker()) Console.WriteLine("Press return to exit...\n")
Console.ReadLine()
End Sub
End Class
End Namespace
//C# using using using using using
System;
System.Runtime.Remoting;
System.Runtime.Remoting.Channels;
System.Runtime.Remoting.Channels.Tcp;
System.Runtime.Remoting.Services;
namespace MSLearning.6.Server {
class Program
static void Main(string[] args)
RemotingConfiguration.Configure(
"StandardServer.exe.config", false);
TrackingServices.RegisterTrackingHandler(new Tracker()); Console.WriteLine("Press return to exit...\n");
Console.ReadLine();
Now that a handler is registered, when a client makes a call to a method in the class used in the preceding code, the handler class is notified. In the preceding example, the handler class simply writes status updates to the console.
Lab 2: Debugging a Remoting Application
This lab illustrates handling .NET remoting exceptions and using the Visual Studio 2005 debugger to attach to and debug a remoting application. Exception handling
Copyright © OnBarcode.com . All rights reserved.