Browser wars

Every so often I update my chart of the technologies people use to view my blog. The last time was back in October last year, and the chart as it looks now is very interesting. The three major browsers (Internet Explorer, Fire Fox and Chrome) are now converging at around 30% share each. Other browsers such as Opera and Safari don’t get much of a look in. However, it does look like I’ll shortly have to start noting down one or two mobile browsers distinctly. Currently mobile browsers are all lumped into the “Other” category.

Meanwhile, on the operating system front Windows XP continues to slowly ebb away. However, the fact that 30% of the visits to my blog are from a Windows XP machine is still painful to see. Vista users are also dying away and are down to about 6% now. At its current rate of decline there will be more Mac users visiting my blog by the turn of the year.

Google Analytics also has a facility to record page load times, however it is currently only reporting from Internet Explorer and Chrome at the moment. That coupled with only 3 months of data so far doesn’t make for very interesting trend watching. However, in a future update I’m sure I’ll add page load times.

32bit ASP.NET App on 64bit Windows 7

Recently we all moved to Windows 7 (64bit) on our development machines. With that, we moved also to IIS7.
So that meant that development copies of websites that we are working on have to
be moved to IIS7. This should be simple. Right?

When I attempted to get the first site up and running I got hit by the error “Could not load file or assembly ‘System.Web’ or one of its dependencies. An attempt was made to load a program with an incorrect format.“.
(The full error message is below.)
After searching around I eventually managed to piece together that the reason
was that IIS was trying to run in 64 bit mode and this application was compiled
as a 32 bit application. Okay…. So how do you fix this?

It turns out the fix is rather easy. In the IIS Manager, open up the list of
Application Pools and select the pool for your application. Right-click and
select “Advanced Settings”. From that point you get this dialog:

32-bit application

Just set “Enable 32-bit applications” to “True”, then Okay the dialog. You then
have to recycle the Application Pool for the change to take effect.

 

 


Server Error in ‘/’ Application.

Could not load file or assembly ‘System.Web’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly ‘System.Web’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly ‘System.Web’ could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

Stack Trace:


[BadImageFormatException: Could not load file or assembly 'System.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190

[ConfigurationErrorsException: Could not load file or assembly 'System.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11207304
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76
   System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +11196482
   System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +185
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +551

[HttpException (0x80004005): Could not load file or assembly 'System.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025

[HttpException (0x80004005): Could not load file or assembly 'System.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +11174792


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

Visual Studio / SQL Server install order on Windows 7

Quite a while ago I blogged about the Visual Studio / SQL Server install order on Windows Vista. I’m about to go through a similar exercise on Windows 7 and given the issues I had then I thought that it would be only right to document the procedure in case any problems arose.

Last time, it would seem, the best solution was to install things in the order in which Microsoft released them with the notable exception of the operating system. So this time, that is the strategy that I’m going to take. Windows 7 is already installed on my laptop. Then I’m going to install Visual Studio 2008, then SQL Server 2008, then any patches for either and we’ll see how we get on.

I’m also going to ensure that I do NOT install SQL Server Express Edition on Visual Studio 2008 as I’ve had problems with that before. Essentially, the problem last time was that the SQL Server installer mistook Visual Studio’s SQL Server Express installation has having installed certain things. The SQL Server installation therefore didn’t want to repeat what it didn’t need to so it refused to install the client tools.

Install Order

  • Visual Studio 2008, excluding SQL Server 2005 Express Edition

Visual Studio 2008 Installer Removing SQL Express

  • MSDN Library (This is optional – I installed it because I’m occasionally developing on the road with no or limited connectivity)
  • Visual Studio 2008 Service Pack 1 (this is required in order to install SQL Server 2008 – the installation will fail otherwise)
  • SQL Server 2008 Developer Edition

sql-server-2008-compatibility-issues

  • Install SQL Server 2008 SP1

That’s it – Job done. And it only took me two attempts to get it right this time. My stumbling block here was the order in which I applied the service packs.

Google Analytics not reporting Windows 7 users

It seems that Google Analytics is not reporting Windows 7 users properly. According to the stats for my blog I’m getting an increasing number of people browsing my blog from Windows NT.

Google Analytics for Windows NT Users on my Blog

I would guess that the operating system is self identifying as Windows NT 7.0 which is why Google Analytics is putting the visits in the NT bucket, but Windows hasn’t been called NT (at least in a marketing sense) since Windows NT 4.0. After that it became Windows 2000* (which Google Analytics is identifying), then XP, Vista and now Windows 7.

* Admittedly with the tag line “Built on NT Technology”

Tip of the Day #9 (The Project Location Is Not Trusted)

This tip is to get a tool called ZoneStripper by James Kovaks to stop the annoying “project location not trusted” dialog box, below, appearing when you open downloaded solutions in Visual Studio.

If you download zipped source code from the web, unzip it and then open the solution in Visual Studio 2008 (and apparently VS 2003 and VS 2005 as well) you may get a dialog that says “The project location is not trusted” … “Running the application may result in security exceptions when it attempts to perform actions which require full trust.” A bit like this:

The project location is not trusted

What happens is that when you download something from the internet Windows (from Windows XP SP2 onwards) will add an alternate stream to the file called zone.identifier. If the file is a zip it will then add that alternate stream to each of the files as it unzips.

You can view this stream by typing something like the following at a command prompt:

notepad DevWeek2009_PreCon.zip:zone.identifier

You can then read the contents of the alternate stream:

What the ZoneStripper program does is delete the zone.identifier alternate stream from the file so that zone aware applications (and the OS) treat the file normally.

Note: If you unzip the files to a FAT based file system then you won’t have a zone.identifier in the first place as the FAT file system does not support alternate file streams.

Showing progress in the Windows 7 Taskbar

I just spotted something really cool in the Windows 7 taskbar. When you download something and minimise the download window in IE to the task bar, the button for the application will continue to show the progress and have a green bar make its way across the button.

Windows 7 taskbar

Windows 7 has some pretty cool features.

Aarrgghh!! Accidentally pressing the Caps Lock key

I keep pressing the Caps Lock key accidentally. I don’t know why, but I do. I think it is the most despicable key on the keyboard, but I am not willing to go to the measures that a former colleague did. He hacked the key off his keyboard.

There are ways to get notified that the button has been pressed accidentally. In the control panel there is a setting that means that each time a “lock” key (Caps Lock, Num Lock and Scroll Lock) is pressed you get notified with a beep. The setting (known as “Toggle Keys”) is part of the keyboard accessibility options.

There are two routes to the setting. The Classic route and the modern route (it depends on how you’ve got your Control Panel configured).

Modern Route

If you are taking the modern route (the default) you need to open the control panel and select “Ease of Access”

Vista Control Panel (Modern)

Then click the link that says “Change how your keyboard works”

Vista Control Panel (Modern)

Classic Route

If you are taking the classic route you need to select the “Ease of Access Center”

Vista Control Panel (Classic)

Then click the link “Make the keyboard easier to use”

Vista Control Panel (Classic)

Finally

Both routes will eventually lead to the same screen. You need to ensure that “Turn on Toggle Keys” is checked (ticked). Once the setting is turned on you can “Apply” or “Save” the settings.

Make the Keyboard Easier to Use

Follow

Get every new post delivered to your Inbox.

Join 26 other followers