Run the MultiRunUnits Demonstration

To run the demonstration:

  1. Start Visual Studio.
  2. Click File > Open > Web Site, specify C:\Users\Public\Documents\Micro Focus\prodname\Samples\MultiRunUnit, and click Open.
  3. Build the solution.
  4. In Solution Explorer, right-click service.asmx, click Set As Start Page.
  5. Start the Web Service by clicking Debug > Start Without Debugging.
  6. Start a second Web Service by clicking Debug > Start Without Debugging.
  7. Click AddTwoNumbers in both browsers.
  8. In one browser, enter 1 as the first operand and anything as the second operand.
  9. In the second browser, enter any operands (except 1) in each field.

To see the data being shared incorrectly, enter False in the UsingMultiRunUnits field, in both browsers. Click Invoke in the browser where you entered 1, and then click Invoke in the second browser. The first result to come back is correct, but the other result is the same as the first, which is wrong. Here's what happens:

  1. The first instance creates a default run unit and sends its data to that run unit and waits.
  2. The second instance uses the default run unit and in doing so, it overwrites the data in the default run unit.
  3. The second instance adds the two numbers and returns the correct result.
  4. When the first instance finishes waiting, it uses the default run unit and adds the two numbers, which are now those from the second instance. It returns the wrong result, the result for the second instance.

Now repeat the demonstration, but this time enter True in the first field. The correct results are returned. Here's what happens:

  1. The first instance creates its own run unit and sends its data to that run unit and waits.
  2. The second instance creates another own run unit and sends its data to its own run unit.
  3. The second instance adds the two numbers and returns the correct result.
  4. When the first instance finishes waiting, it uses its own run unit. It adds the correct two numbers and returns the correct result.