Installing .NET 3.5 SP1 on Windows Web Server 2008 R2 August 28, 2010
Posted by kevinbe71 in .NET, ASP.NET, Development, Web Development, Windows Development.add a comment
One would expect this to be as easy as downloading the .NET 3.5 framework installer and running it. Nope!
—————————
Microsoft .NET Framework 3.5 SP1 Setup
—————————
You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5 SP1.
—————————
The solution is to run this at the powershell command-prompt:
call powershell.exe -noexit -ImportSystemModules Add-WindowsFeature net-framework
(all on one line)
This generates some warnings that can be ignored (I think!) and will install .NET 3.5.
On other editions of Windows Server 2008 R2 it may be possible to do this by enabling a feature but this doesn’t appear to be available in this edition.
NLog and Windows Event Log Bug? November 6, 2009
Posted by kevinbe71 in .NET, Development, Windows Development.add a comment
I’ve been experimenting with a logging library for .NET called NLog. My past experience has been with Log4Net but I’ve not been all that happy with Log4Net so I was looking for a better alternative. NLog seems to be that alternative… but I ran into one glitch when I switched from file and console logging to Windows event logging. I just wasn’t getting anything logged. The first problem was that I didn’t have an event log source defined, so I used WiX to create an event source (pretty easy to do since I’ve already used WiX for this purpose in the past). After that I was a bit puzzled- it still wasn’t working and the nlog internal logs weren’t showing anything either.
It was time to dig into the source code… and what I found out seems to be a bug in NLog. I had a target configured this way:
<target
name="eventlog"
xsi:type="EventLog"
layout="${longdate}|${level}|${message}"
log="Application"
source="My Source" />
I didn’t have machineName defined. After all, the documentation stated that machineName defaults to the local machine anyway, so why set it to anything? Well… because if you don’t then a boolean member var called _operational stays “false” and it needs to be set to “true” for the event log entry to get written! So, the workaround for this is actually pretty easy:
<target
name="eventlog"
xsi:type="EventLog"
layout="${longdate}|${level}|${message}"
log="Application"
source="My Source"
machineName="." />
Anyway, I thought someone else may find this useful if they’re also an NLog newbie…