Flylib.com

Books Software

 
 
 

14.4. Summary

 < Day Day Up > 

14.4. Summary

To run code in a managed environment, .NET creates partitions called application domains for the assemblies to execute in. The AppDomain, which runs inside of a physical process, has the advantage of providing more secure code through code isolation and security boundaries. The boundaries prevent an object in one AppDomain from directly accessing an object in another AppDomain. For them to communicate, .NET provides a set of classes that support remoting —a technique that enables objects to communicate across AppDomain boundaries.

Remoting provides a way to implement client-server or peer-to-peer distributed applications. It's designed to conceal the underlying details of how messages are transported and permit the developer to focus on higher level tasks such as selecting a protocol or the way the transported message is formatted. A key component of the remoting architecture is the use of a proxy on the client side that serves as a surrogate for the remote object. It interacts with the client by presenting the same interface as on the remote object and encapsulates the information required to translate client calls into actual calls on the remote object.

The remote objects can be implemented in several ways: as a singleton that services all requests , as a server-activated single call object that is created each time the object is invoked, or as a client-activated object that persists as long as the client keeps it alive . The three offer a variety of different characteristics that enable a developer to select one most suited for an application.

 < Day Day Up > 
 < Day Day Up > 

14.5. Test Your Understanding

1:

True or False?

  1. A process may contain multiple AppDomains.

  2. An AppDomain may contain multiple assemblies.

  3. An AppDomain can contain both EXE and DLL assemblies.

  4. An AppDomain can be unloaded from memory.

2:

What are the three types of object activation modes, and which protocols can be used with each?

3:

Which activation mode creates a new object each time a client invokes a method on the object? Which mode creates a new object only the first time a client invokes a method?

4:

Explain the difference between CurrentLeaseTime , InitialLeaseTime , and RenewalOncallTime .

5:

What determines how often the lease manager checks for lease expirations?

6:

Which activation modes support the use of leases?

7:

When is a server-activated singleton object created?

  1. When the host begins running.

  2. When the client uses the new operator to create an instance of the object.

  3. When the client first calls a method on the object.

  4. When the object type is registered by the host.

8:

Compare channel registration and type registration.

9:

What is the reason to use SoapSuds or an interface when designing a remoting application? How is SoapSuds used?

 < Day Day Up > 
 < Day Day Up > 

Chapter 15. Code Refinement, Security, and Deployment

Topics in This Chapter

  • Code Refinement: .NET provides a tool, FxCop, which analyzes code by checking it against a set of best practice rules and recommendations. This tool is designed for building components , but most applications can benefit from it as way to amend and refine how code is implemented. An example demonstrates how to analyze code using this tool's command-line interface.

  • Strongly Named Assemblies: One aspect of code security is being able to verify an application's origin and version. .NET provides a way to mark an assembly with a key that identifies it, and supports an assembly versioning scheme that distinguishes between code versions—allowing multiple versions of a component to coexist.

  • Application Security: The .NET Code Access Security model is based on a simple principle: allow code to access system resources and perform operations only when it has permission to do so. Before an assembly can access resources such as files, sockets, or the registry, it is checked for evidence to determine the permissions that it can be given. This chapter explains the overall security model and looks at how it is applied administratively and within code.

  • Application Deployment: One of the touted benefits of .NET is the ability to install an application using XCOPY deployment—simple file copying. However, many applications require a more sophisticated approach that takes into account security policies and resource management. This chapter presents a checklist of issues to be considered .

In the earliest days of programming, computers were used primarily to perform calculations and tedious tabulations. The measure of a program's correctness was whether it produced accurate results for a given set of input values. Modern software development now relies more on component-based solutions. The components often come from multiple sources, and it's not always possible to know the origin or trustworthiness of the components. As a result, code security and the ease of deploying and updating an application are now important metrics against which an application's success is judged.

This chapter looks at the issues and steps involved in producing a deliverable .NET software product. It breaks the process down into the three categories shown in Figure 15-1: code refinement, which looks at how code is tested against best practice rules; code security, which ensures that code is accessed only by other code that has permission to do so; and code deployment, which looks at how an application or component is packaged and made available for deployment.

Figure 15-1. Deliverable software should meet coding standards, be secure, and be easily deployed


The first section shows how to use FxCop as a tool to analyze an assembly and generate code change recommendations based on a predefined set of coding standards. The second section looks at the details of how to create a strongly named assembly and the security benefits that accrue from doing so.

The next section—which forms the heart of the chapter—explores the topic of Code Access Security (CAS). It explains how an administrator uses .NET tools to define a multi-level security policy for a computing environment and how security features are embedded in code. It also stresses understanding the interrelated security roles of evidence, policy , and permissions .

The chapter concludes with a look at the issues to be considered in deploying an application to users or customers. The advantages and disadvantages of using XCOPY or an installer to physically distribute an application are discussed.

 < Day Day Up >