How to speed up site rebuild after compiling a DLL

Came across this little gem this morning.   Made a significant difference on my PC.

Here’s the best one. Add this to your web.config for MUCH faster compilation.

<compilation optimizeCompilations="true">

Quick summary: we are introducing a new optimizeCompilations switch in ASP.NET that can greatly improve the compilation speed in some scenarios. There are some catches, so read on for more details. This switch is currently available as a QFE for 3.5SP1, and will be part of VS 2010.

The ASP.NET compilation system takes a very conservative approach which causes it to wipe out any previous work that it has done any time a ‘top level’ file changes. ‘Top level’ files include anything in bin and App_Code, as well as global.asax. While this works fine for small apps, it becomes nearly unusable for very large apps. E.g. a customer was running into a case where it was taking 10 minutes to refresh a page after making any change to a ‘bin’ assembly.

To ease the pain, we added an ‘optimized’ compilation mode which takes a much less conservative approach to recompilation.

Hosting Classic ASP on Server 2008 R2

Ran into a problem today trying to light up a Classic ASP site that was a copy of an existing site on the same server.   However HTTP 500 errors were all we could get.   Once we enabled debug logging in ASP, we saw that there was a problem with the ADODB connection being able to open the MSAccess database within the site folders.

 

Gotta remember to enable 32-bit apps in the application pool advanced settings.

 

Note: Microsoft Access databases have been popular for many years with developers who use Active Server Pages (ASP) for small-scale applications, but Microsoft Access databases are not designed for scalability, therefore Access databases should only be used where performance is not a factor, and it is best not to host large-scale data-driven applications with Microsoft Access databases.

In IIS 7.0, IIS 7.5, and above, several security changes were made that may affect how classic ASP applications will function. For example, if you were to copy a classic ASP application that uses an Access database that is within the Web site’s content area to a server that uses IIS 7.0 or above, you may receive the following error message:

Microsoft JET Database Engine error ‘80004005’
Unspecified error.
/example.asp, line 100

This is a generic error triggered by the Access driver that may occur for a variety of reasons, but incorrect permissions is a common cause. More specifically, the ability to work with Microsoft Access databases is implemented through the Microsoft JET Database Engine, which creates various temporary and lock files when it connects to an Access database. The following sections will discuss some of the reasons why this may occur and how to resolve those situations.

Working with 64-bit Systems

Unfortunately there are no 64-bit ODBC drivers, so on 64-bit systems you will have to run your applications in 32-bit mode. To do so, use the following steps:

  1. On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
  2. In the Connections pane, click Application Pools.
  3. Highlight the application pool for your application, then click Advanced Settings… in the Actions pane.
  4. In the Advanced Settings dialog, specify True for Enable 32-Bit Applications.
  5. Click OK to close the Advanced Settings dialog.

TortoiseSVN missing icons in Windows 7

Been scratching me head for a while now as to why my Windows Explorer icons for TortoiseSVN were suddenly missing.

After some digging, it appears that DropBox updated itself and added some more shell overlay extensions.   Since Windows 7 only supports 11 overlays, this pushed the Tortoise icon entries too low in the list.

The solution was simple:  edit the registry hive: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShellIconOverlayIdentifiers

and remove the unwanted registry entries so that the TortoiseSVN entries are in the first 11 found.

 

SQL 2012 Management Studio hangs clicking Files menu during database restore

I’ve had this nagging issue for months now.   Every time I go to restore a database from a backup file, I cannot click the Files menu in the left sidebar.   This didn’t happen in SQL Server Management Studio 2008.    But it happens every time in SQL Server Management Studio 2012.

I enjoy using SSMS, it works well for my needs.  So it got very frustrating that it would lock up when I needed it most.

I finally took the time to research and thought maybe a newer version had been released since I downloaded it.  So installed the SQL Server 2012 Service Pack 2 update and sure enough, it fixed the problem.

The download link for the Service Pack is http://www.microsoft.com/en-us/download/confirmation.aspx?id=43340

AbleCommerce Gold How To Clean Up Anonymous Users

Even though Able Gold has a manual cleanup option in the Maintenance page, it doesn’t always work well.  The problem arises from how Able must delete each user individually.  Not such a big deal when you have 500 users to clear out.  

It’s a very different story when you have 2,000,000 unwanted users.   A SQL query can delete all of the unwanted records in a single command.

Below is the updated query to work with Able Gold schema.  Obviously change the dates to something more recent. 

If the queries do not remove as many records as you expected, you might want to remove the “AND (AffiliateId IS NOT NULL)” criteria if you don’t care about affiliate reporting.

use <yourdbname>

DELETE FROM ac_Baskets 

WHERE UserId IN (SELECT UserId FROM ac_Users WHERE StoreId = 1 AND IsAnonymous = 1 

AND (AffiliateId IS NOT NULL ) 

AND (LastActivityDate IS NULL OR LastActivityDate <'June 30, 2009'))

 

DELETE FROM ac_Wishlists

WHERE UserId IN (SELECT UserId FROM ac_Users WHERE StoreId = 1 AND IsAnonymous = 1 

AND (AffiliateId IS NOT NULL ) 

AND (LastActivityDate IS NULL OR LastActivityDate <'June 30, 2009'))

 

DELETE FROM ac_Users 

WHERE StoreId = 1 AND IsAnonymous = 1 

AND (AffiliateId IS NOT NULL ) 

AND (LastActivityDate IS NULL OR LastActivityDate <'June 30, 2009')

SQL Studio Management Expand Databases Slow

So on my development PC, I’ve noticed that it takes 2-3 minutes for the Databases node to expand in my SQL Server Studio Management 11.0.2100.60

I don’t remember exactly when it started.   But it’s been several months I think.  It was just too easy to ignore since I could alt-tab and do something else while it worked through the delay.

Today I decided to research it and determined it’s because some databases have auto_close turned on.   This causes the SQL server to have to start up the database before it can render it in the Databases node.    This creates the significant delay when you have several databases configured for auto_close.

A quick way to fix all of them at once time AND set recovery mode = simple (anything more is useless in my dev environment), use this query:

USE MASTER

declare

    @isql varchar(2000),

    @dbname varchar(64)

    

    declare c1 cursor for select name from master..sysdatabases where name not in ('master','model','msdb','tempdb')

    open c1

    fetch next from c1 into @dbname

    While @@fetch_status <> -1

        begin

        select @isql = 'ALTER DATABASE @dbname SET AUTO_CLOSE OFF'

        select @isql = replace(@isql,'@dbname',@dbname)

        print @isql

        exec(@isql)

        select @isql = 'ALTER DATABASE @dbname SET RECOVERY SIMPLE'

        select @isql = replace(@isql,'@dbname',@dbname)

        print @isql

        exec(@isql)

        select @isql='USE @dbname checkpoint'

        select @isql = replace(@isql,'@dbname',@dbname)

        print @isql

        exec(@isql)

        

        fetch next from c1 into @dbname

        end

    close c1

    deallocate c1

Server 2012 how to set folder permissions ASP.Net application pool

Microsoft tries so hard to make things simple, yet often winds up making them harder. 

I needed to set folder permissions with an ASP.Net 4.0 website running on Server 2012.   The problem was the site worked, but certain folders needed Modify rights.

To make this happen properly, you have to:

1.  Locate the name of the application pool assigned to your asp.net website.  In my case, we’ll call it BlahAppPool.  You can find which app pool is assigned by using IIS Manager and going to the Basic Settings of the website in question.

2.  Now that you know the name of the app pool, the trick to setting folder permissions in Server 2012…

You must add the credentials as IIS APPPOOL\BlahAppPool

You won’t see it listed if you do a search.  It’s a virtual account.  Every app pool gets a virtual account in Server 2012.  And make sure you have the space between IIS and APPPOOL.

Once you get it added, now you can check the Modify right and save.   You remembered to propagate permissions to child objects didn’t you?

AbleCommerce Gold Upgrade errors from 7.0.7

Ran into an odd timeout issue today.  It was disguising itself as an nHibernate problem during the upgrade of an AbleCommerce 7.0.7 store to AbleCommerce Gold R6.

 

The initial error was complaining about nHibernate null Id issues with Catalog.Webpage.  Which made no sense since the upgrade is converting the data, not adding to it.

So I dug into the /install/upgrade.aspx page and saw that indeed new web pages were being added.  And the error was crashing when store.settings.Save() was being called.

I eventually noticed an “errorList” string array variable and exposed it via debug.   It showed me that the SQL upgrade scripts were causing a timeout.   This was silently crashing the upgrade.

After a quick Google search, I found the solution.  In the RunScript() routine within Upgrade.aspx.cs, you have to increase the command timeout value.   Apparently the database I was upgrading was enormous and my local SQL server isn’t really known for speed.  Combine the two factors and you can easily result in timeouts.

Note the addition of setting the CommandTimeout parameter below:

try

{

    SqlCommand command = new SqlCommand(sql, conn);

    command.CommandTimeout = 300;

    command.ExecuteNonQuery();

}

Problem with Jr. Admin security permissions in upgraded AbleCommerce 7 sites

As of Gold R6…

After upgrading an AbleCommerce 7.x website to AbleCommerce Gold, you’ll find the Junior Admin permissions do not work as expected.

In the Old Able 7.x, the role name was “Jr. Admin”.   However in Able Gold, the role name was changed to “Junior Admin”.  This value is hard-coded in various web.config files as well as the /app_data/adminmenu.xml file.

If you upgrade Able 7.x to AbleCommerce Gold, the value does not get updated.  As a result, the new Able Gold install cannot accurately identify a user as an admin user if they are a member of only the Junior Admins group assigned to the Junior Admin role.

The fix is simple.   Open the ac_Roles table in the database and replace the “Jr. Admin” value with “Junior Admin”.   Do the same for the lower case value as well.

How to remove full text catalog index from SQL 2005 database

When moving an older AbleCommerce 7 database from SQL 2005 to a newer SQL server, you might run into errors with the ac_searchcatalog full text index catalog file.   SQL 2008 doesn’t store FTS the same way it was done in SQL 2005.

The issue usually appears when you try to restore the database backup from 2005 to 2008 or greater.

To fix it, you have to remove the FTS file associated with the database.   But it’s not part of the SQL backup, so you have a problem if you didn’t copy the index file separately.   Here’s how to get rid of the index file reference.

Go into the old SQL server and run as follows:

USE <dbname>

SELECT name, ftcatid FROM sysobjects WHERE ftcatid > 0

For each returning table name (which are the tables with Full-Text Index), run this command:
EXEC sp_fulltext_table ‘tblName’, ‘drop’

After all table index references are dropped, get rid of the Full-Text Catalog with:
DROP FULLTEXT CATALOG catalogName

After this is done, don’t forget to remove the file by right-clicking the database, choosing Properties, and then click Files.