Categories
ASP.NET Software Engineering

Determining if an assembly is x64 or x86

After encountering a strange deployment issue today, eventually it was tracked down to an x86 assembly being deployed to a x64 process. There’s a tool included with Visual Studio called corflags that was helpful here. Open up a Visual Studio command prompt, type corflags.exe assemblyname.dll and you’ll see something like this:

Version : v4.0.20926 CLR Header: 2.5 PE : PE32 … Read more “Determining if an assembly is x64 or x86”

Categories
General Computing

Unblocking downloaded DLLs

I find myself regularly forgetting to unblock zip files of various projects (when I’m not using NuGet) and then getting .NET errors around untrusted assemblies. To bulk unblock all files in a directory, simply

  • Download the SysInternals “Streams” utility.
  • Then open a command prompt in the directory you want to fix up, and use the “-d” parameter: streams -d *.dll
Read more “Unblocking downloaded DLLs”
Categories
Software Engineering

NServiceBus audit queues

Being new to the world of NServiceBus, I just thought I’d share a few gotcha’s as I experience them.

When everything’s up and running there’s no easy way to see what’s going on as messages appear and disappear from the normal message queue very quickly. You can use an audit queue to log all messages appearing on a queue. To … Read more “NServiceBus audit queues”

Categories
Software Engineering

Deploying windows services using MsDeploy

Running MsDeploy is awesome for automated deployments of websites, but it’s also possible to use it to deploy other applications to the file system – such as associated windows services. You just need to jump through a few more hoops to get things up and running.

I’m using TeamCity for our integration server, but the basic steps will work regardless … Read more “Deploying windows services using MsDeploy”

Categories
C# Web Development

Saving thumbnails in the original file format with C#

I tripped up on a strange quirk working with the Image and ImageFormat classes recently. The intention was simple – load an Image object from an existing graphic, generate a thumbnail, and save it out in the original format. The Image class in .NET includes a handy “RawFormat” property indicating the correct format to save out in. So far, so … Read more “Saving thumbnails in the original file format with C#”

Categories
ASP.NET Software Engineering

Redirecting from Community Server to WordPress

Just a quick note – if you switch from Community Server to WordPress like I have, in order to keep your links working you can add a simple regex rewrite rule to IIS. I simply used the following:

^/james_crowley/archive/(.*).aspx$ http://www.jamescrowley.co.uk/$1/

and

^/james_crowley/(.*)$ http://www.jamescrowley.co.uk/$1

where /james_crowley/ was where my blog was installed previously (on weblogs.asp.net as it happens).

Categories
Javascript Marketing, SEO & Analytics

Automatically tracking outbound links in Google Analytics

Google Analytics supports a nifty feature called “Events”, which is designed to allow you to track non-pageview type events. This is particularly helpful if you have an AJAX type interface on which you want to gather statistics, but another use I’ve found handy is to track clicks on external links to other sites. If you’re using the asyncronous version of … Read more “Automatically tracking outbound links in Google Analytics”

Categories
Marketing, SEO & Analytics

Google “panda” update – impact on small publishers

An open letter to Google.

I’ve been doing online publishing since 1999, across various successful websites, and have never knowingly been affected by any of your previous algorithm changes – sticking to the motto of great content, and optimizing for our user experience had so far done us well.

However, the Google “panda” algorithm changes being made over the last … Read more “Google “panda” update – impact on small publishers”

Categories
ASP.NET IIS Web Development

Detecting 404 errors after a new site design

We recently re-designed Developer Fusion and as part of that we needed to ensure that any external links were not broken in the process. In order to monitor this, we used the awesome LogParser tool. All you need to do is open up a command prompt, navigate to the directory with your web site’s log files in, and run a … Read more “Detecting 404 errors after a new site design”

Categories
C# Marketing, SEO & Analytics Web Development

Posting to Facebook Page using C# SDK from offline app

If you want to post to a facebook page using the Facebook Graph API and the Facebook C# SDK, from an “offline” app, there’s a few steps you should be aware of.

First, you need to get an access token that your windows service or app can permanently use. You can get this by visiting the following url (all on … Read more “Posting to Facebook Page using C# SDK from offline app”

Categories
C# Software Engineering Web Development

Applying app.config transformations (in the same way as web.config)

Visual Studio 2010 doesn’t have the same support for app.config files in the way that their web projects do, in order to vary connection strings and other configuration settings for different release modes – a real shame. You can vote on the issue here. In the meantime though, the ASP.NET team have a fix, detailed here.

All you need to … Read more “Applying app.config transformations (in the same way as web.config)”

Categories
NHibernate Software Engineering

web.config transformations for NHibernate

If you’re trying to use web.config transformations in VS 2010 with nHibernate you might be hitting the same issue I’ve been getting the transformation to match the hibernate-configuration node. The reason is because you have to specify an xmlns="urn:nhibernate-configuration-2.2" attribute as part of the configuration:

<configuration> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.connection_string">connection string</property> ... </session-factory> </hibernate-configuration> </configuration>

To fix, just set … Read more “web.config transformations for NHibernate”