A 301 is a transparent solution _at_the_web_server_ and is precisely how Google performs such activity:
GET / HTTP/1.1
Host: google.co.uk
HTTP/1.1 301 Moved Permanently
Location:
http://www.google.co.uk/Content-Type: text/html; charset=UTF-8
Date: Fri, 31 Jul 2009 15:57:39 GMT
Expires: Sun, 30 Aug 2009 15:57:39 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 221
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset
=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="
http://www.google.co.uk/">here</
A>.
</BODY></HTML>
... to perform this yourself, you will have to create a new "web site" in your IIS which hosts example.com (no-www) with just a redirect.