twitter
    Find out what I'm doing, Follow Me :)

ASP.Net Failed to start monitoring directory changes

If you run ASP.Net ASP .NET application that is stored in a remote file share and attached via Universal Naming Convention (UNC) paths, you might intermittently get the following error:
"Failed to start monitoring directory changes".

ASP.Net uses the Server Message Block (SMB) protocol to monitor files changes. So that it can reload the application if you made changes to your aspxes, asaxes, or dlls.

However, when more SMB requests exist than the Web server can process, your Web application may unexpectedly restart or you may even lose the session object. To fix the problem,
increase the number of connections that you can have by resetting the registry values of the MaxCmds and the MaxMpxCt keys.

Locate and then click the following key in the registry:
HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\parameters
If MaxCmds and MaxMpxCt keys do not exist, it will use the default value for the client (MaxCmds) which is 50.

So you need to manually adding MaxCmds registry key. The recommended values are 253, 1124, and 2048 to the maximum of 65535. And you have to do the same things with MaxMpxCt keys.

Repeat the above steps on your remote file share server.

For more information refers to:
http://www.kbalertz.com/kb_843584.aspx

Server failed to load application

This week we rolled out Windows XP migration to all our PCs. I had to reinstall all the tools that I have been using since it is not part of the SOE. Everything was fine , eventhough reinstalling Visual Studio .Net took almost half a day , until I tried to run one of my ASP.Net project.

It just doesn't want to run. After turning off the "show friendly error" in IE, it displayed the error message "Class is not registered".

Next, I checked the IIS extension mapping, there is no ASPX registered there. So, I reinstalled ASP.Net by running the command "aspnet_regiis -i". Still doesn't want to run.

After googling for a while, I found this link. It told me to recreate IIS Package, so did I. Indeed, it start to work again.

DateTime & Daylight Saving SOAP Serialization Issue

We had a weird bug that seems like randomly occurred. After banging my head for few days, I found that it was related to DateTime serialization in .Net Framework. This application is an online application form that stored user's date of birth. Some of the users have their date of birth rollback one hour from the value that their originally entered e.g: if the user typed in 2 Feb 1962, it is saved in the system as 1 Feb 1962 11:00 PM.

The data is saved from the ASP.Net web application to the back office system through an Apache Axis Web Service.

We had few problems related to DateTime in the past. Among them are the fact that .Net DateTime is a value type. Hence, it is not nullable type, whereas SOAP Date type is nullable.

We used Apache Axis SOAP monitoring toolkit to monitor what is being sent across the wire. We found out inconsistencies in the date of birth value being sent. Some of them sent with GMT +10 time zone (GMT +10 being Melbourne), and some of them in GMT +11 (daylight saving time).

The problem is .Net Datetime does not store time zone information in the object. And this timezone information is required for the SOAP serialization to work. The only way that .Net can serialized the datetime value is to calculate the timezone information from the setting on the machine. So when the user entered 2 Feb 1962 as his/her date of birth. The datetime object value is 2 Feb 1962 00:00:00 without any timezone information. So before .Net sent the value across through SOAP, it will append the calculated local timezone setting. In this case, .Net thinks that 2 Feb 1962 is within daylight saving period. Hence it is sent as "1962-02-02T00:00:00.0000000+11:00". Which is wrong, because there were no daylight saving in that year in Melbourne timezone (GMT +10). In fact there were no daylight saving in Australia from 1944-1967 (refer here).

Apparently, .Net using some kind of algorithm to determine the daylight saving in the past. It fails to acknowledge that there were political and social events that cancels or changes the normal daylight saving time such as Sydney Olympics or Commonwealth Games in Melbourne. In contrast, Java recognizes that there are no definitive ways to know whether a particular date falls within daylight saving period. Java respect the timezone database which can be retrieved from ftp://elsie.nci.nih.gov/pub/. In this case, Java thinks it is "1962-02-01T23:00:00.000Z" which shifts it an hour earlier. Hence the a day shift in the Date of Birth.

Lessons learned:
  • there is no such things as random bugs. It only means you haven't found the real cause yet.
  • avoid using java.util.Date or .Net DateTime class in webservice for Java & .Net integration. Create a wrapper around these framework classes.
  • programmers should know history :))

Error Occurred while Enlisting in a Distributed Transaction

This afternoon while we are doing pre production deployment for our COM+ QueuedComponent on Windows 2003 Server we encountered an error. Looking at log file we found the error message : "An error occurred while enlisting in a distributed transaction."

Damn, we had this problems before when we deployed this component the first time. But I only vaguely remember it. I wish I've blogged it before so I can refer to it again easily.

Anyway, to fix this problem:
  • Go to Component Services
  • Select My Computer Properties,
  • Click on DTC tab,
  • Select Security Configurations (bottom left).
    1. Under Client and Administration ensure that “Allow Remote Clients” is checked.
    2. Under Transaction Manager Communication, ensure “No Authentication Required” is checked.

Or you can change the registry through registry settings:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\AllowOnlySecureRpcCalls = 0
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\TurnOffRpcSecurity = 1

Another important things is to set your COM+ component settings authentication to none. It is under the "Queuing" tab.

Locked Columns in a Scrollable Datagrid

We are currently developing the second generation of our applications. It was a great success last year. All users love it and give the application very good feedback. When people love something they'll want to make it better and better. That's why we have so many enhancements and feature requests from users. Isn't it nice when people love things that you develop...

One of the features that we worked on this morning is to lock table header and paging navigation in a scrollable datagrid. Not only that they also want to lock the first two column that shows employees' first name and last name on the left so that it stays on the left when they scroll the rest.

We found a couple of solutions from the web. If you worked on IE only the solution using CSS with dynamic expression works fine. If it has to be cross browser try this solution to use CSS positioning.

We had also found this pure javascript control and solutions that create a custom datagrid. And also this one.

Using DotLucene as DotNetNuke Search Data Store Provider

Having used DotNetNuke (DNN) since version 2, I'm really happy to find that in DotNetNuke version 3 included the Search features. I think the DNN team has done a fantastic job in providing such a great framework and APIs.

Yesterday I started to play around with DotNetNuke's SearchDataStoreProvider and ModuleIndexer. I try to provide my own implementation using DotLucene , a open source Search Engine written in C#. It is a port of the famous Jakarta Lucene to .NET maintained by George Aroush.

Why you would say? It is because I think DNN search can be made better. Recently I've seen so many Errors in our DNN sites event log caused by DNN Search Engine Scheduler. DNN default SearchDataStoreProvider and ModuleIndexer is very database heavy. It forced us to turn off the DNN Search Engine Scheduler. So I would like to create a SearchDataStoreProvider that store the indexes in the file system instead of database.

My main goals is to reduce database operations during searching and indexing. For indexing part not much I can do since most of the DNN contents are database driven. But for searching I would like to store all the things required in the indexes in the file system.

What is the better way to do that than to use Lucene, a high-performance, full-featured open source search engine library originally developed by Doug Cutting. For those who are interested in find out why the name Lucene? Lucene is Doug Cutting's wife's middle name.

My early prototype working so well it got me really excited. I got the wildcard and fuzzy search capabilities as well. As an added bonus, the indexes is compatible with Java too.

A couple more things that I want to investigate and extend further:
  • Integrate with Jakarta POI and IKVM to index pdf, word, and excel documents.
  • Investigate of how to do incremental indexing in Lucene
  • Do more research on fine tuning Lucene queries
  • Create an indexing application as windows service on separate box from the web server.

A journey of a thousand miles begins with the first post

I've been thinking of having a blog for quite a while. Here is the first post. I hope many useful posts will follow. Hopefully other find it useful too.