Wf4.0 practice (21): Host wf4.0 application in Windows Server appfabric

Source: Internet
Author: User

In the previous blog introduction to Windows Server appfabric, I briefly introduced Windows Server appfabric. This articleArticle, I will introduce how to apply wf4.0ProgramHost to Windows Server appfabric, and how to persistently configure and track the configuration.

First, I will use Asp.net and wf4.0 to implement a simple pizza ordering system. Then host the application system on the Windows Server appfabric for persistence, tracking, and other configurations.

Pizza ordering system:

There are two parts: one is the UI interface implemented by the Asp.net application; the other is the business logic implemented by the WF service, and the system is similar.

Implement WF service:

The business processing process is: the customer selects the pizza type and the number of pizza fields on the Asp.net client, and then submits them to the WF service for processing. WF service queries the price based on the selected pizza type, calculates the total price of pizza, and returns the price to the Asp.net client. Then the Purchaser confirms whether to order the service. After confirmation, the WF Service reports the corresponding information. This process is divided into two parts.

The first part is the price of pizza.

The second part is: confirm the order, such:

Data entity between the client and the serverCodeAs follows;

 
[Datacontract (namespace ="URN: pizzas")]Public ClassPriceresponse {[datamember]Public IntOrderid {Get;Set;} [Datamember]Public DoublePrice {Get;Set;}}

Implementation client:

A submission interface is very simple, such:

Background code:

         Protected  Void Button#click ( Object Sender, eventargs e) {feedmeclient client = New Feedmeclient (" Basichttpbinding_ifeedme "); Priceresponse prse = client. getpizzacst (dropdownlist1.text, Int . Parse (textbox1.text); viewstate [" ID "] = Prse. orderid; label1.text =" Order Number: "+ Prse. orderid +" The price is "+ Prse. Price. tostring (); client. Close ();} Protected  Void Button2_click ( Object Sender, eventargs e ){ If (Viewstate [" ID "]! = Null ) {Feedmeclient client = New Feedmeclient (" Basichttpbinding_ifeedme "); Label1.text = client. confirmorder ( Int . Parse (viewstate [" ID "]. Tostring (); client. Close ();}}

How to host this application to Windows Server appfabric.

First, install Windows Server appfabric. For the installation sequence, see Windows Server appfabric.

Step 2: generate a zip package for WCF, select a service project, and right-click build deplyment packpage. You can see the generated ZIP file under the \ OBJ \ debug \ package path, for example:

Step 3: Open IIS and create a new website named richeat izzaservice. The port number is changed to 90, for example:

Step 4: Select deployment, as shown in figure

Step 5: select the package and click Next until the package is complete.

Step 6: Configure Persistence: select the service and right-click the configuration, for example:

Temporary workflow Configuration:

Configure workflow host management:

Step 7: configure the trail:

1. Create a text file in \ OBJ \ debug \ package, enter the following text, and change its suffix to TP.

<Trackingprofile name =" Customserviceprofile "> <Workflow activitydefinitionid =" * "> <Workflowinstancequeries> <workflowinstancequery> <states> <state name =" * "/> </States> </workflowinstancequery> </workflowinstancequeries> <activitystatequeries> <activitystatequery activityname =" Getpizzaco St "> <States> <state name =" Closed "/> </States> <variables> <variable name =" Quantity "/> <Variable name =" Type "/> </Variables> </activitystatequery> </activitystatequeries> <faultpropagationqueries> <faultpropagationquery faultsourceactivityname =" * "Faulthandleractivityname =" * "/> </Faultpropagationqueries> <bookmarkresumptionqueries> <bookmarkresumptionquery name =" * "/> </Bookmarkresumptionqueries> <customtrackingqueries> <customtrackingquery name =" * "Activityname =" * "/> </Customtrackingqueries> </workflow> </trackingprofile>

2. Configure monitoring: select the newly created TP file in the following interface and click OK.

 

Effect:

1. Select a pizza on the ASPX page and enter the number you want, for example:

2. Click Submit to obtain the total pizza price, for example:

3. Click "OK". The pizza store will tell you that your pizza is on its way and you can just wait.

4. View on Windows Server appfabric:

I have already made seven pizza reservations.

Select an instance to view the tracing information:

 

You will see the following event information:

This application is very simple, so you cannot view the effect of persistence.

Summary:This article teaches you how to publish and use the wf4.0 application on Windows Server appfabric and configure Windows Server appfabric.

Attachment:Pizza ordering systems code http://files.cnblogs.com/zhuqil/WFServices.rar

Related Article

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.