maandag 28 januari 2008

Debugging the .NET framework

As I've written earlier, Visual Studio.NET 2008 makes it possible to debug code that can be found on a source server.
I think this can be very interesting and I can think of numerous situations where this can be very handy.
Suppose you work in a company that uses an in-house developped framework, and you're building an application that uses this framework.
If you experience some strange behaviour inside your application, you can debug your code and step into the code of the framework to see if the company's framework has a bug.

I've read that Microsoft has setup a source server which contains the debug-symbols of the .NET framework, so, as from this month, it is possible to step into the .NET framework source-code as well!
Setting up VS.NET 2008 to enable this is very simple; you can find a step-by-step guide here.

The Mozilla team also have a symbol server. You can read more about it here

dinsdag 15 januari 2008

Cannot open log for source {0} on Windows 2003 Server

I am writing an application which uses some .NET remote components that are hosted in IIS on a Windows 2003 Server.
When the remote component throws an exception, the exception information should be written to the EventLog on the Windows 2003 Server; however, Win2k3 seems to be a bit restrictive when a component that is hosted in IIS wants to write to the eventlog.
Although the component does not run under the IIS_WPG or ASPNET account (I am using Windows Impersonation), I always received the following exception when the .NET remote component wanted to write something to the eventlog:

Cannot open log for source {0}. You may not have write access. Access is denied

You can get rid of this behaviour and make sure that the error is indeed written to the EventLog by following the steps below:

  • Open the registry on the Win2k3 server using regedit
  • Locate the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\Application key
  • Find the CustomSD key and append the following string to the existing value: (A;;0x0002;;;AU)

Now, the (impersonated) remote component should have rights to write to the EventLog.

Now, what is the meaning of the string you've just added to the CustomSD key ?