# Friday, March 05, 2010

When someone runs CSWorks Pipes and Tanks Demo application for the first time, the first question is: where all this data for pipes, tanks and valves comes from?

CSWorks installation package includes LiveData Emulator OPC Server component that simulates mixing process and accepts input from the user when he/she opens and closes the valves and changes mixing speed. LiveData Emulator OPC Server is useless for real-world applications but works well as a simple data source for the demo.

In order to make sure that CSWorks displays actual data supplied by this OPC data source, you may want to set up a quick demonstration and see how numbers are changing simultaneously in the demo and in your favourite OPC viewer application.

First off, if you just run OPC viewer on the demo machine and connect it to CSWorks LiveData Emulator OPC Server you will see some tags changing, but those changes won't be in sync with the demo values. This happens because of the way COM/DCOM (and OPC) works.

Unless you configured it otherwise, CSWorks LiveData Service runs under Network Service user account - a special Windows account many system services run under. When CSWorks LiveData Service is being told to access an OPC server (Emulator OPC Server in our case), it instantiates it through COM/DCOM infrastructure. By default, a COM server is started as a separate process on behalf of the launching user - Network Service. If you have a look at the process list while CSWorks demo is running you will see LiveData Emulator process running under Network Service account.

Now you run an OPC viewer application and connect it to CSWorks LiveData Emulator OPC Server. Have a quick look at the process list again - you will see that now you have another instance of LiveData Emulator process running under your personal account. So you have two emulators supplying different data to CSWorks and to the OPC viewer.

Let's make both CSWorks and OPC viewer use the same instance of the emulator. Please use Windows Service Manager to configure CSWorks LiveData Service so it runs under you personal account (say, Administrator). Also use DCOM configuration tool (dcomcnfg.exe) to make sure that LiveData OPC Emulator:

  • can be launched (Properties - Security - Launch and Activation Permissions) and accessed (Properties - Security - Access Permissions) by your personal account;
  • is instantiated runs under interactive user account (Properties - Identity).


This screenshot shows what has to be done.

After doing that, restart CSWorks LiveData Service and your OPC viewer, so they start using properly configured LiveData OPC Emulator server. The screenshot shows three application windows: two Internet Explorer instances with CSWorks demo application, and a third-party OPC viewer that is configured to receive updates for "storage.numeric.reg01" tag. This is the item that CSWorks demo application uses to store Tank 1 fill level.

As CSWorks LiveData Emulator changes Tank 1 fill level, you see it changing in all three windows simultaneously. Perfect, we get the same data in all three windows.

After demonstrating CSWorks live data in action, do not forget to revert all changes made in DCOM configuration and service manager.

demo | opc
Sergey Sorokin   Friday, March 05, 2010 2:07:31 PM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Wednesday, February 24, 2010

One of the first things I would do after installing CSWorks is to open a browser on another machine in the network and type in "http://MyTestBox/CSWorksDemo/PipesAndTanksDemo.html", where MyTestBox is the name of the machine where I installed CSWorks.

This doesn't work. And it's not supposed to work because of the cross-domain web service call restrictions imposed by your browser. If you have a look at ServiceReferences.ClientConfig file in the Pipes and Tanks Demo xap package (CSWorks.Client.PipesAndTanksDemo.xap in your CSWorksDemo/ClientBin folder; don't worry it's just a ZIP file with XAP extension), you will find endpoint description for LiveData web service calls that looks as follows:



In our case, when Silverlight is trying to make a web service call to http://localhost/CSWorksDemo/LiveDataWebService/Service.asmx, the browser checks the URL of the application which happens to start with "http://MyTestBox". Since it doesn't start with "http://localhost", the browser considers this a potential security threat and blocks the call.

To make things work, just replace "localhost" in the config file with the name (or IP address) of your CSWorks server:



and save updated config to the xap file. Now refresh the page in the browser on the remote machine - Pipes and Tanks Demo should work fine.

Update (June 25, 2010):

with Silverlight 4, you can use relative web service addresses, see this post for details.

Sergey Sorokin   Wednesday, February 24, 2010 4:24:27 PM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Monday, February 22, 2010

Users who are new to .NET web development keep asking asking questions about CSWorks installation errors related to IIS and ASP.NET, here are some of them:

Cannot connect to Internet Information Server. (-2147221164)

IIS (Internet Information Services) version 5 or higher must be installed

IIS (Internet Information Services) version 7 or higher and IIS 6 Management Compatibility (appcmd.exe) must be installed

All these messages signal about the same thing: IIS/ASP.NET is not working properly on this machine. Please follow the steps below to install IIS/ASP.NET on your machine

Windows 7, Windows Server 2008, Vista

I will describe the process for Windows Server 2008. Windows 7 interface is very similar, Vista interface is slightly different, but names and descriptions are pretty much the same.

In "Programs and Features", click on "Turn Windows features on or off". See screenshot.

Add Web Server Role if needed, and click on it to configure. See screenshot.

Select all Web Server role service required for ASP.NET application hosting as on the screenshot below. Please pay special attention to the "Application Development" and "Management Tools" sections. See W2K8 screenshot , or Windows 7 screenshot.

You may need to enable ASP.NET ISAPI extension manually. Find "ISAPI and CGI Restrictions" under IIS properties (see screenshot), and enable ASP.NET extensions (see screenshot).

Windows XP

Go to Settings -> Control Panel ->Add or Remove Programs -> Add/Remove Windows Components. Select "Internet Information Services", and select required components - see screenshot.

Navigate to your Microsoft .NET windows directory which is usually C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and run aspnet_regiis -i and aspnet_regiis -c.

Go to My Computer -> Manage -> Services and Applications -> Internet Information Services, Select "Default Web Site", right-click on it and modify ASP.NET tab of site properties so it uses ASP.NET 2.0. See screenshot.

Update: starting from CSWorks 1.4.3820, choose ASP.NET 4.0 in this drop-down.

Windows Server 2003

Go to Settings -> Control Panel ->Add or Remove Programs -> Add/Remove Windows Components. Select "Internet Information Services", and select required components - see screenshot.

Navigate to your Microsoft .NET windows directory which is usually C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and run aspnet_regiis -i and aspnet_regiis -c.

Go to My Computer -> Manage -> Services and Applications -> Internet Information Services, Select "Default Web Site", right-click on it and modify ASP.NET tab of site properties so it uses ASP.NET 2.0. See screenshot.

Update: starting from CSWorks 1.4.3820, choose ASP.NET 4.0 in this drop-down.

Select "Web Service Extension" node of local IIS server and enable ASP.NET v2.0 extension.See screenshot.

Sergey Sorokin   Monday, February 22, 2010 9:33:43 AM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Thursday, February 18, 2010

What's new:

  • Trend Control and Trend Demo
  • Breaking change in history database format: LastValue observations
  • Multiple Historical Data improvements
  • Historical Data documentation
Sergey Sorokin   Thursday, February 18, 2010 9:23:49 AM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Monday, January 11, 2010

What's new:

  • Historical Data Support
Sergey Sorokin   Monday, January 11, 2010 11:33:39 AM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Saturday, October 31, 2009

What's new:

  • Documentation added
  • Improved data source error handling
  • Breaking changes in client framework: web service config files
  • Alarm Agent samples
Sergey Sorokin   Saturday, October 31, 2009 2:00:49 PM (Pacific Standard Time, UTC-08:00)  #     |  Comments [0]  | 
# Friday, October 09, 2009

What's new:

  • Breaking changes in client framework (PlainDoubleDisplay instead of PlainNumericDisplay)
  • 64-bit OS support
  • Non-English OS Support
  • No more third-party OPC servers in the demo
  • No more emulator service in the demo
Sergey Sorokin   Friday, October 09, 2009 12:14:31 PM (Pacific Daylight Time, UTC-07:00)  #     |  Comments [0]  | 
# Monday, September 28, 2009

While working on one of my projects, I had to make WCF run over a farm of load-balanced message queues. After several days of web search, asking questions and coding I have come up with the following "Step-by step guide for setting up certificate security for WCF over MSMQ communication".

The goal is to implement a secured WCF communication based on MSMQ under the following requirements/assumptions/recommendations.

  • All MSMQ traffic must be encrypted and signed.
  • No involvement of Windows Domain security and Active Directory.
  • No code changes required on the client or on the server side.
  • MSMQ version 4.0 (W2K8) is used, but it would be nice to have a solution that works on MSMQ 3.0 (W2K3) as well.
  • There must be a well-established and straightforward routine for setting up secured communication that can be followed during test/staging/production deployment.

The weapon of choice is message-based certificate security. To put it simple, it means two things:

  • all security-related activities happen on WCF level, MSMQ engine works only as a transport;
  • certificate keys are stored on client and server machines.
  • Read on...

    msmq | security | wcf
    Sergey Sorokin   Monday, September 28, 2009 9:52:32 PM (Pacific Daylight Time, UTC-07:00)  #     |  Comments [0]  | 
    # Sunday, September 13, 2009

    What's new:

    • Breaking changes in DataManager (DataItem collection)
    • Microsoft Excel 2007 sample (SOAP Web Service)
    • No more third-party OPC RCWs
    Sergey Sorokin   Sunday, September 13, 2009 10:01:12 PM (Pacific Daylight Time, UTC-07:00)  #     |  Comments [0]  | 
    # Wednesday, September 09, 2009

    What's new:

    • Added LiveData Agent examples (WCF, SOAP, Multiplexor)
    • Added "caseSensitive" setting to OPC LiveData Provider
    • SQL LiveData Provider now supports ODBC data sources
    Sergey Sorokin   Wednesday, September 09, 2009 10:11:53 PM (Pacific Daylight Time, UTC-07:00)  #     |  Comments [0]  |