Since only Angels get code running right the first time around, it is useful to actually be able to debug UDFs.

The way to debug UDFs is to attach to the w3wp.exe process that is running Excel Services and place a breakpoint in your UDF. However, if you bring up the process list in Visual Studio (Ctrl-Alt-P), you will see that there are multiple w3wp.exe processes running. Show how to pick?

You could attach to all of them - that would certainly work, but it would make debugging more sluggish and potentially more noisy.

To figure out the process id that is the correct one, you can use the IISAPP script. Just execute the following command in the console, and you will see the correct process id:

iisapp /a SharedServices1

The output will look like this:

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

The following W3WP.exe processes are serving AppPool: SharedServices1
W3WP.exe PID: 1980

That means that the process ID to attach to is 1980.