Rolebased Security

Roles are used to group together users and groups that need to perform similar functions within an application. Roles are defined at the application level. Role-based security can be performed on the component, interface, and even the method level. Both server and library applications can implement roles and apply them to their components. Figure 5-2 shows the expanded list of roles for one of the applications on my computer. Notice that I can specify multiple roles within one application. In...

Single Call Component Using Binary Formatter and TCP

Using the TCP channel on the client and server is not much more difficult than using the HTTP channel. If you use the TCP channel, however, you must find a host other than the Web server to host the component. For this example, I use a console application to host the component. Usually, you want to host the component in a Windows service so that someone does not need to be logged on to the server console, but for this example a console application adequately demonstrates the TCP channel. You...

Converting Assemblies to COM Type Libraries

The .NET SDK comes with two tools that can be used to generate type libraries from assemblies the Type Library Exporter (tlbexp.exe) and the Assembly Registration Tool (regasm.exe). The Type Library Exporter takes an assembly as input and produces the corresponding type library as output. The Assembly Registration Tool also produces a type library from a .NET assembly and registers the type library and its COM classes in the Windows Registry. Because we are concerned with more than just...

Marshaling by Reference Versus Marshaling by Value

One of the first things you should think about when designing a remote class is whether you want the client to get its own local copy of the class or whether you want the class to stay on its original server and have clients access the component remotely. The framework considers classes that follow the former scenario to be MarshalByVal marshal by value types. When a client accesses these kinds of classes, the framework makes a copy of the running instance of the class and transports it across...

Exception Handling

Although queued components provide a robust environment for distributed applications, problems can still arise. For example, a client may not have sufficient rights to send a message to a component's input queue. In other situations, a component may not be able to process a message that has reached its queue. The second scenario can be particularly nasty because it can lead to a poison message. To handle client errors and server-side errors, COM provides a way for you to specify an...

Developing MSMQ Applications by Using C

For years, developers have used MSMQ COM components or MSMQ API functions to develop applications that use message queuing. These APIs allow developers to read from queues, write to them, and perform management tasks such as creating them. The .NET Framework provides a similar set of APIs for the C developer. The System.Messaging namespace System.Messaging.dll contains all the classes, interfaces, and enumerations you need to develop .NET applications that take advantage of of MSMQ's features....