Setting the identity for ASP.Net application pools

I just run into an odd problem. For testing purpose I wanted to run a ASP.Net application with some privileged account. So just for the heck I created a new app-pool in IIS and assigned this pool to my app. Then I set the identity of the app pool to my own domain-account – this should definitely work, since I’m a local administrator on this dev-machine – who if not the admin should run an app?

But the eventlog stated something strange: the identity of my newly created app pool is invalid! And accessing the app kinda proves this: the app pool is being deactivated in IIS.

But now to the rescue: the identity setup in the app-pool must be a member of the local IIS_WPG group.

IntelliSense for MSBuild community tasks

OK, you probably know it by now … there is a whole lot of stuff writte in nice angle-brackets, but there is way to little intellisense support for all this.

Just like others (NHibernate, WCF) the solution is quite simple: just copy the appropriate xsd file to C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\1033. In this case the MSBuild.Community.Tasks.xsd can be found in C:\Program Files\MSBuild\MSBuildCommunityTasks.

Batching Statements in NHibernate

Picture the case where you want to insert/manipulate a mass of data using your already in place NHibernate infrastructure.

Usually you would do something like this:

for (int i = 0; i < 100; i++)
{
MyEntity entity = new MyEntity(i);
session.Save(entity);
}

This has the drawback of producing a single INSERT per save call, and thus creating 100 roundtrips to the database; one per insert. Further more the actual INSERT command will be re-constructed for each single Save call.

To circumwent some of these shortcummings you should start a new transaction and wrap all Save calls in this transaction:

ITransaction tx session.BeginTransaction();
for (int i = 0; i < 100; i++)
{
MyEntity entity = new MyEntity(i);
session.Save(entity);
}
tx.Commit();

This will at least reuse the command-object created for the first Save call.

If your’re using MS-SQL you can benefit from further enhancements. NHibernate offers the capability of batching statements. By adding a configuration setting for hibernate.adonet.batch_size with a value greater than 0 will enable batching. In conjunction with the transaction only after the in batch_size specified commands have been recorded this batch is send to the DB. So with a hibernate.adonet.batch_size of 10 the above code would result in 10 roundtrips instead of the original 100.

Running SQL Express and SQL Standard simultaneous

On a simple dev-machine I would usually only install the SQL express edition. While this is sufficient for local development for simple databases, this doesn’t give me a GUI to manage my database.

Espically in bigger projects I might want to work with the database directly, or maybe I want to look or edit a database on an separate server. This doesn’t work at all with the express edition.

OK, so instead I install the regular edition of SQL Server. This gives me the Management Studio to easily manage my databases, but unfortunately this denies some features of the express edition, which only available in the express edition. One feature is attaching standalone mdf files as database. This is a feature needed especially for web-application, because a lot of ASP.Net data is stored in such an attached mdf file.

A common scenario for SQL 2005 was to have both express and the “regular” edition installed side-by-side. Beasue these editions come each with their own installer and seem to be considered separate products, this install does cause some problems. For example you will most likely not be able to install neither SP2 for the express edition nor the regular editions.

SQL 2008 seems to relief this pain a lot, because the installer offers to install the regular edition as well as express edition. This allows to install both editions and run them side by side.

The next level of FireFox

So I upgraded recently to the current beta of FireFox (which makes this FireFox 3.1 beta2). Everythings looks really cool, except that you will have to tweak your profile a little to get all the nice extensions working, which are not yeat aware of FF 3.1.

This is just like the move to FF 3.0 … so I did what I already knew about twiggeling FF for extensions.

But still one extensions is just not “behaiving”. That is the Tab Mix Plus extension 0.3.7.3. But fortunatly the new dev-build 0.3.7.4 fixes this issue.