Wednesday, 24 February 2010

IIS 7.0 not serving CSS files

After a rebuild of IIS 7, I couldn't get any CSS files to return. If I browsed to the path http://localhost/styles.css, I would a blank page (even when I view source). The problem was that during the reinstall of IIS I forgot to add the Static Content Component.

For Vista and Windows 7:
Control Panel -> Programs -> Turn Windows features on or off

Then navigate to: Internet Information Services -> World Wide Web Services -> Common HTTP Features
Enable the Static Content option

Friday, 19 February 2010

Cannot load macro project error

After moving 'My Documents' folder to a different drive, I started getting an error when loading the macro's explorer window. The error was:

Cannot load macro project '' for the following reason:

'C:\Users\\Documents\Visual Studio 2008\Projects\VSMacros80\Samples\Samples.vsmacros' is an invalid or inaccessible macro project file

The problem is when you move your documents folder, this updates the environment variable %USERPROFILE%, but the macro's path for Visual Studio are stored in the registry.

Searching the registry I found the following two keys which had a 'path' value, referencing the C:\.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\OtherProjects7\0
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\vsmacros\RecordingProject7


To solve, change the 'path' values in the above keys to your new location and restart Visual Studio.

Attach to multiple w3wp processes

This is an update to a previous post as I am now working on a project that can have up to 3 w3wp processes running.

I've changed the following lines:

Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, compName).Item("w3wp.exe")
proc2.Attach2(dbgeng)


with:
For Each proc2 As EnvDTE80.Process2 In dbg2.GetProcesses(trans, compName)
If proc2.Name.Contains("w3wp.exe") Then
proc2.Attach2(dbgeng)
End If
Next

Wednesday, 3 February 2010

Visual Studio and Spark

There is a great post about setting up file icons, Templates and syntax highlighting in Visual Studio for spark templates here:

3 Useful Visual Studio Tricks for Spark Templates

Thursday, 28 January 2010

IIS7 and basic authentication

I needed to use basic HTTP authentication to secure a site instance as it required pulic access for a demo.

However, in IIS7, the only authentication modes listed are the default Forms, Anonymous and ASP.NET Impersonation.

To solve this, I had to install the basic authentication module for IIS.

For Server 2008:
  • Server Manager -> Roles -> Web Server -> Add Role Services

For Vista and Windows 7:
  • Control Panel -> Programs -> Turn Windows features on or off

Then navigate to: Internet Information Services -> World Wide Web Services -> Security
Enable the Basic Authentication option

Thursday, 7 January 2010

Debug prompt in VS 2008

When trying to debug an application using VS2008 on Windows 7 64 bit, I keep getting the following prompt, which is quite annoying.

debug prompt
To disable the prompt, you need to edit the following registry key. Ensure that Visual Studio is not running whilst you change the registry.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Debugger
Set DisableAttachSecurityWarning attribute value to 1.

Monday, 4 January 2010

Open command window here...

Windows XP came with a nice little powertoy “Open Command Prompt Here”, which enabled you to use the navigate around the file system and then were able to open a command prompt at the current location.

In Windows 7, you can now simply hold the Shift key down while right clicking on a folder and you'll see the option to "Open command window here".

Thursday, 24 December 2009

Windows 7 and Application Pool Identity Accounts

Creating a new Application Pool in IIS creates a new security identifier (SID), which is a virtal account. The new identity takes the same name as the AppPool, so a new AppPool with the name 'NewAppPool' creates a new security identifier with the name 'NewAppPool'. You can now use this virtual account so secure your files and folders. However, because the identity is a virtual account it will not show up as a user in the Windows User Management Console.

To use the identity to secure your folder, you need to do the following

  1. Open Windows Explorer

  2. Select the file or directory.

  3. Right click the file and select "Properties"

  4. Select the "Security" tab

  5. Click the "Edit" and then "Add" button

  6. Click the "Locations" button and make sure you select your machine.

  7. Enter "IIS AppPool\NewAppPool" in the "Enter the object names to select:" text box.

  8. Click the "Check Names" button and click "OK".
You can now configure the permissions for the "NewAppPool" identity.

A better article on this from learn.iis.net

Monday, 21 December 2009

Turn Off UAC in Windows 7

I find the UAC prompts quite annoying in Windows 7. He is how to turn the propmt off:
  1. Go to Start Menu -> Control Panel -> User Accounts and Family Safety -> User Account.

  2. Click on User Account Control settings link.

  3. Slide the slider bar to the lowest value (towards Never Notify)

  4. Click OK

  5. Restart the computer to turn off User Access Control.

Tuesday, 15 December 2009

Hide Live Messenger from the Windows 7 Taskbar

I've just installed Windows Live Messenger and it annoyingly sits in the taskbar rather than the system tray like on Vista and XP.

The trick is to tell Live Messenger to run in Vista Compatibility mode.
  1. Ensure Windows Live Messenger is not running.
  2. Go to Start Menu and locate the Windows Live Messenger shortcut.
  3. Right click on the Windows Live Messenger shortcut and select Properties.
  4. Select the Compatibility tab.
  5. Tick the check box for Run this program in compatibility mode for under “Compatibility Mode”, and then select Windows Vista from the drop down list.
  6. Click OK.
  7. Run Windows Live Messenger.