MOM Notes

We are  using MOM 2000 for monitoring the application.

Below are a few links that I found useful :
How to delete orphaned server/s records from “OnePoint” Database in particular shows that in OnePoint
 database Event.idGeneratedBy =computer.idComputer  , which is useful for queries per computer.

We periodically have a long delay(sometimes up to 30 min) before events from computers appear in MOM.
I noticed that delay disappeared after a message “A rule has generated 50 alerts in the last 60 seconds… In order to avoid excessive load on the consolidator, this rule will be temporarily disabled”. 

Event Type: Warning
Event Source: OnePoint Operations
Event Category: None
Event ID: 21251
Date:  10/12/2007
Time:  11:47:02 PM
A rule has generated 50 alerts in the last 60 seconds.  Usually, when a rule generates this many alerts, it is because the rule definition is misconfigured.  Please examine the rule for errors, and also consider creating an event consolidation rule for events that may match the rule.

In order to avoid excessive load on the consolidator, this rule will be temporarily disabled until 10/12/2007 23:57:02.

Rule description:
Rule Id:      {05ED1868-F50D-11D3-AB6D-0090275A4C62}
Group Id:     {064902E1-AA35-4B79-987D-4748E59FF534}
Name:         Operations agent attempted to process responses
Provider Id:  {F6DA1507-12AF-11D3-AB21-00A0C98620CE}
Provider: Application
Event Number == 21252
Source Name == OnePoint Operations
Type:         Event Processing Rule

 MOM 2000 Generates Numerous Entries About Event ID 21252 suggests to find a rule by using search within the MOM Administrator Console to find the rule that is generating the events  or use SQL, e.g.
   Select * from processrule where idprocessrule=’05ED1868-F50D-11D3-AB6D-0090275A4C62′

Search showed that the rules is located under “Microsoft Operations ManagerAgents, Consolidators, or Data Access Servers”.

There are other related links that I used to investigate delay

Suppression of 25261 errors  exposed under: Information Services/Internet Information Services 6.0/Core Services/World
Wide Web Pulishing Service\Event Rules All HTTP 400 errors 

OnePoint Free Data Space Percentage thread suggests to shorten your periods between grooming intervals.You’ll find this in the Global Settings of the MOM Administrator Console.

WatiN testing of multi-level Frames page

I wanted to use  WatiN Web Application Testing In .Net, to test  html page with multi-level frames:

E.g TopFrame.aspx :
     <FRAME SRC=”ContentFrame.aspx”>

     <IFRAME SRC=”SubFrame.aspx”>

When I tried to check ie.Frame(“ContentFrame”) it didn’t show me html of ContentFrame.aspx(as expected), but showed html of parent  TopFrame.aspx. I’ve attached debug version of WatiN and stepped through to opening page. And in debugger  ie.Frame(“ContentFrame”)  was populated correctly.

I thought that the problem is with timeout of loading down-level page(SubFrame.aspx in my sample). Unfortunately 
increase of TimeOut didn’t help.
I’ve done a few attempts in debugger and sometimes(when I had breakpoints in IE.CreateNewIEAndGoToUri and DomContainer.WaitWhileMainDocumentNotAvailable) it loaded html of content frame, but mostly showed parent’s frameset.
There are some ideas to try in discussions: best way to find if webbrowser is totally ready and Webbrowser Wait!.

I’ve reported the problem to WatiN bug list 1747471 “Frame is not loaded for page with multi-level frames”.

#championsfcb, #fcb, #fcbarcelona, #messi, #musablaugrana, #suzycortez

ASP.NET Exception Handling links

There are a few articles about ASP.NET Exception Handling that I want to bookmark.

User Friendly ASP.NET Exception Handling -very good library, in particular for logging Unhandled Exceptions in ASP.NET Web Services. Minor disadvantage is that it uses propriatory logging, not Enterprise Library Logging Block.

Take Exception To Critical Errors With Custom Application Blocks shows how to use Enterprise Library to build an error-reporting framework and post them to remote web server.

Article Rich Custom Error Handling with ASP.NET   describes how to pass Exception to Custom Error Pages  using one of state objects: Application, Context, Cookies, and QueryString.

 I didn’t understand why article stated, that Response.Redirect()  can’t use Session as storage basket?.  Later I found(see my post Passing Exception details in Session to Custom Error page. ) that it is possible. 

I’ve noticed that Exception has Data property to keep any custom key/value pair. However Data is not included in ToString, and overide is required if you want to trace/log it.(see also Giving Exceptions the Extra Info They Need with Exception.Data)

Links to many other articles can be found in the CodeIdol article “Exception Handling  

Consider to use Exceptions Visualizers


My DataBinderHelper class.

Previously I’ve posted a few Helper Classes . This post describes my DataBinderHelper class.

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web.UI;

    public class DataBinderHelper
        public static bool IsPropertyExist(object container, string propName)
            if (container == null)
                throw new ArgumentNullException(“container”);
            if (string.IsNullOrEmpty(propName))
                throw new ArgumentNullException(“propName”);
            PropertyDescriptor descriptor1 = TypeDescriptor.GetProperties(container).Find(propName, true);
            if (descriptor1 == null)
                return false;
            return true;
/// <summary>
/// </summary>
/// <param name=”container”></param>
/// <param name=”propName”></param>
/// <example>DataBinderHelper.EvalWithDefault(DataItem, “VPath”, “”)</example>
/// <param name=”defaultValue”></param>
/// <returns></returns>
        public static object EvalWithDefault(object container, string propName,object defaultValue)
            object oRet=defaultValue;
            if (IsPropertyExist( container,  propName))
                oRet = DataBinder.Eval(container, propName);
            return oRet;
        /// <summary>
        /// </summary>
        /// <param name=”container”></param>
        /// <param name=”propName”></param>
        /// <param name=”format”></param>
        /// <param name=”defaultValue”></param>
        /// <example>DataBinderHelper.EvalWithDefault(Container.DataItem,”CreationDateTime”,”{0:d}”,””)%</example>
        /// <returns></returns>
        public static object EvalWithDefault(object container, string propName, string format, object defaultValue)
            object oRet = defaultValue;
            if (IsPropertyExist(container, propName))
                oRet = DataBinder.Eval(container, propName, format);
            return oRet;

Tools to debug/Trace ASP.NET applications.

I personally hate to open blogs, that just have list of links without more useful information. But as I wrote in Ways to store bookmarks/favorites post, blog is a convinient way to save favorites. So I will just save links for now, and hopefully will add more comments about them later.

FIDDLER supports HTTPS, ensure that  “Capture HTTPS Connects” and “Decrypting HTTPS traffic”  are ticked in in “Fiddler options”. However running Fiddler in “https mode” can have side effects, e.g. my connection to TFs is not working until I close Fiddler .     

Web Development Helper by Nikhil Kothari -utility for Web developers and plugs into Internet Explorer.ScottGu (and I agree)prefer it over  Fiddler for some ASP.NET and AJAX specific scenarios .

Java application Charles (30 day evaluation) is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP traffic between their machine and the Internet.

YATT (Yet Another Trace Tool) – replacement of trace tools ( tcpTrace, proxyTrace, pcapTrace ), 

I love Internet Explorer Developer Toolbar , in particular “Find by Click” option.

Using System.Net Tracing  – very useful .Net 2.0 features activated in web.config – allows to see details of requests and responces.
Use trace Output tool,e.g.Dbwin32 or DBMonitor.On development machine use Visual Studio Output window.
It is recommended to increase
maxdatasize to avoid text truncation,e.g. 
 <source name=System.Net maxdatasize=4096>

However if you know more about format of requests and responces, it is better to write custom code to represent data in more readable format.
In paricular, when I am sending SOAP requests, it’s better to trace them as XML, rather than view generic hex/ascii dump table (like 6E 64 2E 63 6F 72 70 2E-6D 69 63 72 6F 73 6F 66 : nd.corp.microsof).
It should be considered SOAP extensions, including WSE 3.0.
If you just use Web Services, not WSE 3.0, you can use described in MSDN logging Soap extension, or SoapLogger , or use code from User Friendly ASP.NET Exception Handling.

The hints how to make you class more debugger-friendly (not specific to ASP.NET ) are posted in Easier Debugging with Attributes

Unit Testing ASP.NET Applications

I will put a few links related to ASP.NET unit testing.


Initially I saw reference to WATIR from Scott Hanselman’s post Integrating Ruby and Watir with NUnit .

Recently I’ve found WatiN Web Application Testing In .Net, including articles WatiN – Web Application Testing In .Net – The Code Project – ASP.NET and WatiN Test Recorder – The Code Project .(The home page for WatiN Test Recorder is here

There is interesting article by Jeremy D. Miller   with comment from ScottGu recommending WatiN .

Using regular expressions in WatiN (e.g. for long IDs)


Also WatiNFixture is a custom fixture for FitNesse – acceptance testing framework.


From MSDN Overview of ASP.NET Unit Tests  it seems, that you can only test business classes in App_code. However there is a blog post describing Testing the page object for an ASP.NET site  .

HttpRuntime simulator.

To simulate ASP.NET server functionality(i,e.HttpRuntime I am using class based on Haacked’s  HttpSimulator. May be should be considered. 

Comments on closed problems in “MS Connect” are ignored.

I’ve asked MS Supportregarding : does MS staff receive notifications when someone adds Community Discussion comment, Rating or Validation comment for closed issues?Or it is better to raise a new issue to grab MS staff attention? It will be good to put the answer to “Submit and Track Feedback”section.

They replied  that no notification is sent to MS staff for a closed bug. If a new bug is submitted for the same issue, it would likely be identified and closed as a duplicate.

I considered to post the following as a suggestion to MS.

Let’s consider the following scenario.
I noticed some bug/limitation in Visual Studio. I opened  Feedback website and found that somenone reported the similar problem back in 2005 and it was closed with resolution “postponed” or “Won’t fix”(which often means postponed) or “external”. I believe that the issue is important and want to ask MS to review/re-consider the resolution. To do this I am adding   Community Discussion comment and/or Rating or Validation comment  with assumption that MS staff will be notified about my comments.
Based on your answer that no notification is sent to MS staff for a closed bug, I wouldn’t achieve what I wanted. An ability to add  Community Discussion comment, Rating or Validation comment  is MISLEADING and causes confusion for users.
It will be good to show warning when user adds comment to the closed issue.

However I found similar ACTIVE issue raised here: Improve feedback comments handling and reactivation   ,so I just voted as important. 

Lesson learned: If I want to ask MS to read/review/re-consider the closed issue, I have to submit a new bug/suggestion report.

Workaround “The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect” error.

We have a .Net 1.1 application that worked with SQL server 2000. When we changed it to work with sql Server 2005, some calls to SPs returned errors like the following

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 8 (“@ParamName”): The supplied value is not a valid instance of data type numeric. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.”

It was found, that C# decimal variable can keep values with more than 4 decimal points (e.g. 43.23232322323) and when it is passes to SP parameter as MONEY, combination .Net 1.1 – SQL Server 2005 doesn’t work.
Note that combination  .Net 1.1 – SQL Server 2000 and  .Net 2.0 – SQL Server 2005  work fine.

To workaround I’ve added simple function to round values before assigning SP parameter

       public static decimal SafeMoney(object attribute)
            decimal decMoney = Convert.ToDecimal(attribute);
            decMoney = Math.Round(decMoney, 4);//required in 1.1 to connect to SQL Server 2005
           return decMoney;



Unable to run WSDL.exe against Example from Web Services Description Language (WSDL) 1.1

I need to create WSDL file for RPC/Encoding soap implementation.
To learn how to create the WSDL I took an
Example 5. SOAP binding of request-response RPC operation over HTTP from Web Services Description Language (WSDL) 1.1 specification

and tried to run WSDL.exe for the file.

 I have to fix couple simple errors
1. removed
wsdl: from wsdl:arrayType

2. Changed StockQuoteBinding to StockQuoteSoapBinding in  <port name="StockQuotePort" binding="tns:StockQuoteBinding">

And then I’ve got the error:

 The operation ‘GetLastTradePrice’ on portType ‘StockQuotePortType’ from namespace ‘‘ had the following syntax error:  The operation has no matching binding. Check if the operation, input and output names in the Binding section match with the corresponding names in the PortType section.

I gave up to fix the sample from standard specification that doesn't work.
It is quite annoying.

My RegexMatchsHelper class

Previously I’ve posted a few Helper Classes . This post describes my RegexMatchsHelper class

I also added a few related links:

Use Regular Expressions to Constrain Input in ASP.NET

using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
      /// Summary description for RegexMatchs.
      public class RegexMatchsHelper
            public RegexMatchsHelper()
                  // TODO: Add constructor logic here
//          public static void RetrieveMatchedStringTest()
//          {
//                string sResp=StreamHelper.FileToString(“searchManyPages.htm”);
//                string pattern=”tokenKey=(.*?)&target=results_ResultsList”;
//                string sRet=RetrieveMatchedString( sResp, pattern);  
//          }
            //assumed that pattern has something like (.*?) inside
        public static string CaptureFirstUnnamedGroup(string input, string pattern)
            return CaptureFirstUnnamedGroup(input, pattern, RegexOptions.None);
        public static string CaptureFirstUnnamedGroupIgnoreNL(string input, string pattern)
            return CaptureFirstUnnamedGroupIgnoreNL(input, pattern, RegexOptions.None);
        public static string CaptureFirstUnnamedGroupIgnoreNL(string input, string pattern, RegexOptions options)
            // SingleLine Has nothing to do with how many lines are in the input string. Rather, will cause the . (period) metacharacter to match any character, instead of any character except n, which is the default.
            return CaptureFirstUnnamedGroup(input, pattern, options | RegexOptions.Singleline);
        public static string CaptureFirstUnnamedGroup(string input, string pattern, RegexOptions options)
                  string sRet=“”;
            Regex regex = new Regex(pattern, options);
                  Match m = regex.Match(input);
                  if((m.Success) )
                        if ((m.Groups.Count>=2) && (m.Groups[1].Captures.Count>0))
                               sRet= m.Groups[1].Captures[0].Value;
                  FSHelperLib.DebugHelper.TracedLine(” captured “ + sRet );
                  return sRet;
        /// Returns array of matched strings
        ///<param name=”input”></param>
        ///<param name=”pattern”></param>
        ///<param name=”options”></param>
        public static string[] MultipleMatchesFirstUnnamedGroupCaptures(string input, string pattern, RegexOptions options)
            //string sRet = “”;
            Regex regex = new Regex(pattern, options);
            MatchCollection matches = regex.Matches(input);
            string[] asCaptures = new string[matches.Count];
            int i = 0;
            foreach (Match m in matches)
                Debug.Assert(((m.Groups.Count == 2) && (m.Groups[1].Captures.Count > 0)));
                asCaptures[i] = m.Groups[1].Captures[0].Value;
               // FSHelperLib.DebugHelper.TracedLine(” captured ” + sRet);
            return asCaptures;