Developer
I often want to talk about Microsoft's future strategies in the following aspects: COM, Microsoft Transaction Service (MTS), and its JIT engine and Object Buffer (Object
Pooling ),
Microsoft Message Queue (MSMQ) and DCOM. What is the relationship between websites, application servers, ASP, and component integration? Since everyone is clamoring for answers, let's solve the problem once.
These problems exist. First, let me explain the issues related to com and MTS.
Software Development Network
UseComAndMTSSoftware Development Network
COM has always been popular, so if you need to use the characteristics of COM or MTS, you can use Microsoft.NET component. I think: no matter whether the component is released or not, it is part of the solution..The components in net are like COM components, because both are DLL containing classes and can be instantiated by another application. The main difference between them is that their implementation methods are different, which is beyond the scope of our discussion.
Considerations
There are several options for components used in an application. You can choose to use Com, MTS, or both. Com
And Mts are built on COM components. In this way, if you want to create a component that can run both of them, the component must comply with the binary standards of COM and can be used
First, you must register in the registry.
.. NET Framework (same as Visual Basic.. Net) supports COM and MTS through the com interoperability service. A window-based application (a COM component or an application similar to a COM component) can be called.. NET component. Similarly,.. NET application can be called a COM component. The collaboration capabilities of these two methods are powerful, allowing you to mix and use their technologies in your applications.
As I said, COM and MTS are built on COM components. If you.The. NET Component (Compiled) is placed in an MTS package or a com application, the component can be.NET application calls, just like directly calling.. NET Component, not an MTS or COM component.
When using COM for interoperability, a potential problem is that the system overhead is increased. Because.. NET and COM are executed in different ways (.Net (Common Language Runtime); COM is not), and.The implementation of the Net Program and the COM component is also different (.Net
Uses the type standard, while the com uses the binary standard ). Calling from one environment to another obviously adds a lot of system overhead, so only use Com for interoperability if necessary. Actual
For each mutual operation, you need to execute about 20 to 30 CPU commands. If you call a method based on the com class, the system overhead will be increased for each such call.
If you
The program must indeed use com features or MTS features, and you are sure that all functions are required, then put your components in COM
Or put it in MTS. If your component executes transactions on a single database and will always work only on a single database, you do not need to use com to implement those transactions. You can use ADO.Net to implement them. However, if you need object buffering or support for multi-database transactions, you can use com or MTS.
If you want to implement the components in MTS or com, you should check.Net Framework, and view information about com. These documents will show you how to implement components and how to use different attributes to automate processes.
UseDCOMAndMSMQRemote Communication
You can use.Net remoting. You can also use web services to replace DCOM. So what are the differences between the two methods? The difference is that your application and how you communicate in different program segments, and whether the program structure has a front-end ASP.. Net. You can place the code in multiple places of the program.
First, you can put the code in APS.. Net. This makes the page similar to most ASP pages, and the code is connected to the output page. In this case, the application is not distributed, but a dual-layer architecture, that is, ASP.. NET is on the frontend, and the database is on the backend.
Second, you can put the code in a module. If you define a module in your project, a module file is a simple visual basic file. You can place functions and global variables in the module so that you can call them anywhere in the program. In this way, the module replaces the inclusion files used to store the shared code.
Third, you can start porting the shared code to a class set. A file with a class definition and an interface (attributes and methods) or a file section is called a class. You can.Create a class in the. Net project to make it a part of the project. You can also create a project to implement a class. The latter method is popular because of its common code, because the shared code can appear in the form of DLL. As in the com world, this dll can be shared by many applications.
Let us assume that this class contains the code for accessing data and is used to execute transactions. For illustration, I use the design shown in Figure 1. This figure contains two.The ASPX page calls a business object to obtain required information. No matter whether the customer, product, or order object calls the database layer object, the database layer object then performs data access or information updates on the database.
This application does not need MSMQ or.Net remoting or web services, because all components are on the same server. You can move the database-layer components or business components to another server,.. NET applications, it is faster to put all components on the same server. Why? Because components can be like ASP.. NET applications run in the same program space (the same process), thus eliminating inter-process communication. Is the fastest way to access components. Any time you call an out-of-process component, the system overhead is increased, which slows down the running of your application.
Software Development Network
Http://www.mscto.com
If the provider
You can also split it and place some components on another server. For example, if the application allows the user to input data and send it to the database after processing, the system is busy and often transmits
A bottleneck occurs when sending data. One way to alleviate this problem is to insert MSMQ into this process. Generally, your application collects information from the user, notifies the user of being executed, and sends the information
MSMQ. The application can retrieve information from the other end of the queue and update the database. The performance of such applications will be quite good, because users do not have to wait for database updates. However, this structure is only applicable to applications.
It works only when the program supports a connectionless architecture.
Of course, you can also use MSMQ when you need a queuing system. You can use some classes in the system and message namespace to add queuing support to your application. These queuing features are also integrated in Visual Studio.Net, so that you can easily obtain these features from your application.
When you move the database layer to the database server, you can expose the database components together with the Web service, or.Net remoting. You can use any technology to create a component server for each component. In this case, select.Net remoting or web services depends on your needs. One feasible method is to place ASP. NET applications on the application server and some components required by the application server on the component server. There are two ways to communicate between applications on the application server and components on the other server.
I. You
You can only create a web service on the application server.
Service provides methods to access different components. This method allows applications and components on the application server to use the Web
The service accesses the components on the component server. This method is flexible and simple. This is the need to explicitly create a web service that exposes class methods.
2. Applications on the application server can use.Net remoting to access the components on another server. This method is flexible and superior to web services in many aspects..Net remoting is easy to create..Net remoting architecture is integrated in.. NET Framework, and provides the architecture for inter-process communication between components on different systems that you need. This architecture provides a transmission channel through which your applications communicate over the network.
.Net
Remoting supports many different regions, such as built-in security. You must also consider the security of the data transmitted in the two components. It works with the Web
One difference between services is that it can change the data packet type transmitted between the two ends of a call. Web
Services are based on the Simple Object Access Protocol (SOAP) industry standard. Remoting can use soap, XML, or binary format. For
Type, you have a choice. You can select the binary format because it is safer and more compact than the lengthy XML format.
The architecture in Figure 2 is a little more complex. In the figure, there is a Minicomputer in the LAN and a Web server, which is connected to the LAN through the firewall. By using web services or.Net remoting, which communicates with applications on different servers. Because most Web servers can place Web Services.. NET applications can also communicate with minicomputers through those services, and vice versa. In this way, applications on Minicomputers can call.Web services on the. NET Server..Net remoting can also be run.NET Server communication, so that.. NET applications can communicate with servers and applications on different operating systems.
Of course, firewall is also a problem. Since they generally support HTTP and do not support other protocols, what protocol does the Web server communicate with other servers? Of course, in this case, Web services can still work normally, because the transmission protocol is HTTP..Net remoting also supports HTTP as the transmission protocol. However, for performance and security considerations, you can also use TCP/IP.
. NetSerialization in
Software Development Network
As many readers have asked about serialization in. net, I will give you a brief overview here. Generally, a class provides a serialize Method for output data and a deserialize Method for retrieving streams and returning data to the class.
In the past, processing serialization was what programmers had to do. Currently, this serialization processing function is integrated in.Net
Framework. Imagine a salesperson who needs to download a batch of data from the server to his notebook before seeing the customer. So he used the data locally, and then re-connected to the server program, and sent the data back
Go back. Workstation applications can use the web
The service connects to the server and calls a class method to obtain data. After the data is serialized, the result is sent to the customer. Then, you can save the serialized XML Stream and store the results locally.
. Then, the salesman can restart the application to load the XML Stream to a local copy of the class. Then, the application sends continuous streams back to the server program, and the server program deserializes it,
Update the database.
.Other classes in. Net also use serialization. For example, data assembly is automatically serialized when an XML Stream is input and deserialized when an XML Stream is output..Net remoting and queuing also use serialization.