Microsoft stocktrader 2.03 Study Notes (3)-Example of configuring website and Configuration Service in stocktrader

Source: Internet
Author: User
Tags msmq

For configuration websites and Configuration Services used in stocktrader 3.0, Microsoft has provided detailed descriptions in its configuration instructions. It is basically a step-by-step explanation. Here we will simply pick out the key and make a simple record in the document, and take a look at the entire configuration process.

First, let's briefly introduce the Core Components in stocktrader 3.0:

. Net stocktrader web application-website UI masterProgram

. Net stocktrader business services (hosted in IIS or in the. NET Self-Host Program) -- main business logic Service (the example provides two implementation methods: IIS host and self-host)

. Net stocktrader order processor service -- order processing service (from the main business logic Service)

After the example is installed, all components are running in the same Asp.net process by default, and no remote service calling technology is used. However, by configuring websites and Configuration Services, you can deploy them in different processes or even machines to easily implement the distributed architecture of applications. Of course, for the purpose of study, you can also use different host port configurations on the same machine to simulate the entire test process.

The system architecture diagram provided by Microsoft is as follows:

 

Next, let's follow Microsoft's stocktrader configuration instructions to learn more about website configuration and Configuration Services:

In the first step, log on to the configuration website, open the configweb page for installation, and you can see the login/Logout link. Click it to go to the logon page. It should be emphasized that the overall system architecture is configured from top to bottom. In other words, the system first enters webappui, webappui connects to the main BSL, and the main BSL connects to other BSL, it can further implement any n-layer architecture. On the logon page, you need to enter the user name and password, as well as the expected host service endpoint. Here we select the default website application service endpoint. The user name and password are the default initial User Name Admin and password YYY during installation. You can also modify the user name and password in the production environment configuration, you can log on to the configuration service you want to modify on the configuration website. On the Configuration Management page, click the user management link to modify the user name and password.

After logging on, we can see the main interface for setting the website application of stocktrader. Here we can see the running status of the current host service. If the current system has been configured to use Server Load balancer, we can also see the defined cluster nodes. Of course, we can also adjust the configurations here to meet the needs of other systems. By default, other business logic service components run in the same. Net process without any remote service calling technology. The * mark is used on the page.

 

Of course, you can also reconfigure the main business logic service used by the stocktrader web application. First, let's use a remote master business logic service component hosted in IIS, click the link marked in red circles to go to The stocktrader web application configuration management page.

On the Configuration Management page, we can see three configuration groups: Basic settings, specific settings, and advanced settings. The default setting is basic settings. In the settings table below, we can see the current settings of the current system. Here we need to do is to remove the accessmode of stocktraderwebapplication from the default process (inprocess) change to a remote business logic service mode. For details about the specific business logic service mode, see the configuration reference document. Click the link marked in red to go to the specific settings page. Select the IIS host web service mode (iishost_webservice). Make sure that it is case sensitive. Click the update button to activate the current settings, and then click the configuration link to return to the configweb Master Settings page.

Go to the configuration management main settings page again, and we find that the previous main business logic service and order processing service under the stocktrader website application is missing, this is because we have changed all the business logic services to remote activation calls. However, there is no remote service connection, And the stocktrader website application needs to connect to and use the remote service instance, to achieve this, you need to enter the connections management interface to add a remote connection point.


Click the Add connection button to view a remote service instance connection list. The service list definition is displayed on the configuration management main settings page. Click the edit defined services link to manage the settings. Here we select the last option, the iis host wcf Service Type instance. Change the remote host connection address to the address installed on your machine, and keep the port 80 set. Click "add connection" and return to the connection management page.

Note: On the connection management page, we can see that two connections have been added, because the 2.0-based asmx and 3.0-based WCF are implemented in the same iis host application, return all connection types by configuring the service. However, there is only one access mode that is currently activated and used (highlighted in green on the page). Next we will return to the Setting home page through the configuration link.

Here we can see an online remote service configuration area. Now you can use a stocktrader Website user to log on to the actual stocktrader website (not the configuration website ), all the operation activities between you will occur in the remote business logic service instance, rather than the default in-process service instance. Of course, you are not aware of this change.

Next, we will implement the configuration of remote calls within the business logic service, and the processing of a third-tier order through an independent service instance. How to configure order processing is implemented by configuring the main business logic service. Here we will not directly use web application configuration, because the order processing service is an extension of the business logic service layer, and Web applications cannot perform operations across layers, the order processing service logic is invisible to the Web application logic.

Select the business logic service instance of the IIS host as the first node. Next, you will see that the main configuration interface is changed to the main interface for configuring the business logic service instance of the IIS host. The first node is always on the left side of the page, the remote connection service is always on the right side of the page. The subsequent configuration process is basically the same as that of the Web application to reconfigure and activate the remote master business logic. The difference is that the iis host business logic instance is configured to remotely call the order processing service.

We can achieve this by configuring the Order Mode of the main business logic service. Click the Red Circle link to enter the specific setting interface. The main business logic can have multiple different order processing service mode instances to choose from. In the order mode selection bar, select the value to go to the specific modification page. We select async_msmq, that is, connection to the transactional MSMQ queue service instance processing mode. Click the update button and prompt that the update is successful. Note that the order processing service instance is not hosted in IIS and is an independent host application. Of course, we can also host it in IIS 7 or later versions. And start it.

On an unused instance, The MSMQ Message Queue required by stocktrader is automatically created when the order processing service instance is started for the first time. If the MSMQ Windows component instance is not installed on the host instance, the host instance of the order processing service cannot be started (if you really need to change the configuration settings of the host of the order processing service to ignore this restriction, You can implement it through service/configweb ).

In this way, you can call the remote order processing service instance for the main business logic service instance by adding a remote order processing service connection in the configuration of the main business logic service. To achieve this, go back to the connection management page on the configweb page. On the application connection management page of the website, you can directly access the connection management page of the main business logic service by configuring the intermediate connection features of the system and access the page through the link marked in red circles.

Similarly, click the Add new connection button marked in red circles. Then you can see the default order processing business logical connection options. Enter the name or address of your computer. The Order Processing Configuration Service will listen on port 9002 through HTTP. Click the Add button to indicate that the operation is successful. Click return to the connection management page to view the active connection. Note: If you click the connections link, you will directly return to the stocktrader website application connection management interface. Then you need to repeat the above steps to view the active connections of the main business logic service.

On the main business logic service connection management page, you can see multiple active connection instances. This is because the order processing service host runs four service instances with different protocols at the same time. Further, we can arbitrarily change the ordermode settings so that the main business logic service instance can be used (HTTP, TCP, MSMQ-transacted queue, MSMQ-in-memory-queue) any of these settings. In all circumstances, the order processing service is not just remote, they will also be processed asynchronously in the main business logic Service (because all order processing service contracts are defined as one-way ).

Finally, click the configuration link to return to the configweb homepage. Initially, you will return to the website application as the first node.

By clicking the link marked in red circles, you can select the primary business logic service as the first node. The main business logic service is on the left side, and the new service is added to the remote order processing service connection on the right side.

Similarly, you can further expand the service layer and use the order processing service instance as the first node to configure its settings. After completing the above configuration, you can now use a stocktrader Website user to try to place an order. Of course, the entire order processing process will follow the architecture you configured.

1. The website application submits a request synchronously through HTTP web service to the master business logic service instance of the Remote IIS host.

2. Create an order header in the database for the main business logic service instance of the IIS host, and submit the order details to the remote order processing service instance asynchronously through the message mechanism for order processing.

3. The Order details message is not directly sent to the order processing service host instance, but is loosely bound through the wcf msmq binding mechanism. Through the features of MSMQ, we can deploy MSMQ message queues to other remote servers or other independent service host instances on the same machine.

4.wcfbase layer basic will automatically notify the client application (trade.orderservicehost.exe) to trigger the service contract method to process the order.

5. The order processing service replays the order transaction and saves the processed results to the database. After the order is processed, users in the website application will be notified.

6. If the processing logic of the database fails, the transaction will be rolled back automatically because of the distribution, and the order information in the transaction queue will not be lost. If a transaction queue is forcibly set to run in order, it will be automatically retried n times in a delayed mechanism (mainly based on the binding settings of the WCF Service ). If it cannot be processed successfully, it will be automatically sent to the harmful queue without interfering with normal processing, at the same time, ensure that messages are not lost (note that harmful queues only exist in msmq4.0 ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.