Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Getting Started

Stonehenge .NET StockTrader for Apache is a subset and fork of Microsoft's .NET StockTrader Sample Application on MSDN. The original StockTrader can be used as a reference. It is located at http://msdn.microsoft.com/en-us/netframework/bb499684.aspx. A main difference is that this version does NOT include the configuration management features of the MSDN .Net StockTrader. Configuration is done manually. The expected audience is an experienced developer with knowledge of C# and SOA with WCF.

Installing the Stonehenge/Apache .Net StockTrader Application

  1. Get software from https://svn.apache.org/repos/asf/incubator/stonehenge/trunk/stocktrader/dotnet/
    1. It is recommended that you use Tortoise (http://tortoisesvn.net/) to download the entire source tree to C:\StockTraderDemo.
  2. Install Prerequisites, if you don't have these requirements you can follow the Express Requirements Install Guide
    1. Internet Information Server (IIS) - Web Service Role with Static Content feature enabled
    2. Install Visual Studio 2008 or Visual Web Developer Express 2008
    3. Install .NET 3.5 SP1
    4. Install ASP.NET 3.5
    5. Install SQL Server 2008 with mixed mode authentication
      1. Enable the sa account with a password. You will need the password for sa later.
      2. If SQL Server 2008 is already installed without mixed mode authentication and/or sa is disabled:
        1. Open the SQL Server 2008 Management Studio
        2. Connect to SQL Server using windows authentication
        3. Right click the server name and choose properties
        4. Go to security tab. Change server authentication to "SQL Server and Windows Authentication mode"
        5. Click OK and restart SQL Server
        6. Go to SQL Server 2008 Management Studio
        7. Expand the server and choose security and expand logins
        8. Right click on sa, from properties modify the password and confirm password
        9. If you setup IIS before this you may need to run setup_utilities\util\servicemodelreg64.cmd (or servicemodel.cmd if you run 32 bit)
        10. Optional: You may want to enable network discovery so you can browse to shares with code. This may not be needed for a single server install but if you are going to use more than one machine then this is a good option.
  3. Seed the database and create accounts
    1. Open the solution setup_utilities\SetupActions\SetupActions.sln
    2. Open the App.config in your solution. When you build the project this will be renamed to [program name].exe.config.
    3. If you checked-out the solution to a different directory then C:\StockTraderDemo, then update the installPath setting with the proper path.
    4. Set the dbserver key to point to your MSSQL instance. You might be able to set it to "." for the simplest case. If you use SQLExpress or a named instance it will be different (eg. ".\SQLExpress").
    5. Set the right dbPassword for the sa account.
    6. Run the project
    7. Press any key when the SetupActions has completed.
  4. Open ports 8000 and 9000 on your firewall.
    1. Control Panel->Windows Firewall->"Allow a program through the fire wall"
    2. You will get to a dialog, choose exceptions Tab
    3. Click Add Port
    4. Name it "8000" and put 8000 in the port Number field
    5. Repeat for 9000
  5. Setup the website under IIS
    1. In IIS manager
    2. Right-click Default Website and choose Add a Virtual Directory
    3. Enter trade as the alias.
    4. Select trader_client\trade as the physical path
    5. If your running vista, right-click the virtual directory and choose Convert to Application.
  6. Install the Test Certificates
    1. Install three certificates: setup_utilities\Util\ stocktraderpfxfile.pfx, BSLClient.pfx, OPSHost.pfx
    2. Run mmc
    3. In mmc go to File -> Add/Remove Snap-in...
    4. Add Certificates and select Computer Account and choose Next then choose Finish.
    5. Push Ok to return to mmc
    6. Now, open the Certificates Folder, and then open the Trusted People folder.
    7. Right click on the Trusted People folder, and choose All Tasks, Import.
    8. This will bring up the Import wizard.
    9. Choose Next, then click Browse.
    10. Make sure to change the displayed file types to "Personal Information Exchange (*.pfx; *p12) file types.
    11. Browse to and select the setup_utilities\util\stocktraderpfxfile.pfx file.
    12. Click Next.
    13. You will be prompted for a password. The password is 'yyy'.
    14. Click Next, Next, and Finish to import the certificate to the \Local Computer\Trusted People certificate store.
    15. Repeat for the BSLClient.pfx and OPSHost.pfx certificates.
    16. If you are running Windows Server 2003 or Windows XP you will need to repeat these steps with the Local Computer\Trusted Root Certificate Authorities folder.
  7. Build the solutions
    1. Double-click the BuidDotNet.cmd script to build the solution
    2. Binaries are copied by build to order_processor\bin\Debug, business_service\bin\Debug, trade_client\bin\Debug respectively
    3. If you specified a database instance name in the section 3, you will need to update the config files for the Config_Service to point to the proper database instance. The config files are located in the same directory as the .exe files, and they contain the extension .exe.config.
  8. Run the StockTrader demo
    1. Start the Order Processor, Configuration and Business Services.
      1. Right click the RunServices.bat file and choose Run as Administrator. (Running the AuthorizeWcfServices.bat script in the \Util directory will prevent you from having to always run the services as Administrator)
      2. Choose either a run mode of either Debug or Release.
      3. This will start the ConfigurationService, OrderProcessorService, BusinessService console applications.
        Note
        titleNote

        Console App should remain open and active (do not exit application!)

    2. In a browser, run the Web app http://localhost/trade/

Configuration

The default configuration for the .NET StockTrader Website is to use the DotNet_Http_WcfService for communicating with the Business Service, and ASync_DotNet_WsHttp_MSecurity when processing orders. For more information on configuration options see the Stonehenge Interoperability Walk-through.

Utilities

Inside the setup_utilities/Util folder you will find a number of different scripts. For more information about these scripts see the .NET Utilities List