Serving RSS on IIS

 Posted by at 3:32 pm  Web, Work
Mar 162008
 

A couple of website authors out there have had a little difficulty figuring out how to get their web sites set up with mediaRSS feeds to support PicLens browsing.  You can follow our instructions for how to construct a mediaRSS feed and link it into your HTML pages and still get no joy from PicLens on your site.  What’s going on?

The common thread? Using Microsoft IIS as your web server.  It’s easily fixed, but let’s first review how to diagnose the problem on your web site:

  1. Verify that you have placed your mediaRSS file (we’ll call it photos.rss here) on your web server in a public directory.
  2. Verify that the file access rights for your mediaRSS file are set to allow others to view it (chmod 644 on Linux boxes, readable by everyone on Windows)
  3. Verify that you’ve inserted a <link> tag in your HTML, as covered earlier.  The href attribute in the <link> tag can be a relative URL (like href=”photos.xml” or href=”../../foo/photos.rss” or href=”/files/foo/photos.rss”) or a fully-qualified URL (like href=http://mysite.com/files/foo/photos.rss).  It can even refer to a different web domain, though this generally is not a good idea (be sure to check with the owner of the other domain first).  Note that relative URLs are relative to the HTML page’s location, so pay attention to where you’re putting things.  The easiest setup is to simply put the HTML and RSS files in the same directory, and use relative URLs with no path at all.
  4. Now comes the fun part.  Fire up your browser, navigate to your HTML page and move your mouse over one of the images on your page.  Does the PicLens launch button appear in the bottom left corner of the image?  If yes, you’re done!  You may have a cookie.  If not, something is missing from your configuration.  Go to step 5.
  5. If the launch button does not appear in the bottom left corner of an image on your web page, try the PicLens launch button up on the browser toolbar instead (Firefox).  If you launch PicLens from the toolbar button and PicLens says something like “This site is not PicLens enabled” or somesuch, that means that PicLens could not find a mediaRSS feed for your HTML page.  There are only three causes for this:  Your HTML page does not contain a valid <link> tag, or the href in the <link> tag is not the correct URL for your RSS file, or your server is not serving up your RSS file.
  6. Right click on your HTML page in the browser and select “View Source”. Search the HTML source code for the <link> tag you inserted earlier.  If your <link> tag pointing to your RSS file isn’t there, you may need to flush your browser’s file cache and/or recheck whether you’re putting the files in the right place on your web server.  Go fix that, then restart this checklist from the top.
  7. Ok, so the <link> tag is there in your HTML, but PicLens doesn’t like it. Verify that the RSS file is actually being served by your web server:  Type the <link> tag href URL into your browser address bar.  If it’s a relative URL, put http://your_domain_name.com at the front, of course.
  8. If you get a 404 or other server error, you now know why PicLens isn’t showing your images – your server isn’t serving up the RSS file!
  9. If your browser prompts you to save the file to disk (and you’re not using IE6), this may also indicate a server problem – the web server is sending the file, but it is telling your browser that it is a binary file rather than an XML text file.  You need to set the MIME type for the file on the web server.

Problems #8 and #9 both indicate that the web server doesn’t know how to send your RSS file over the network.  On Apache / Linux, File not Found or Not Authorized errors can be caused by not setting the correct file permissions (644) on the file.  Apache usually has a MIME type definition for .xml and .rss files already set up.  For IIS, though, “some assembly is required.”

Configuring IIS for RSS

Microsoft IIS in its default configuration does not recognize RSS files, and for security reasons won’t serve anything it doesn’t understand.  IIS does have a default configuration for .xml files, but since .xml is used for a lot more than just RSS it’s probably a good idea to make a separate definition just for RSS.

You need to tell IIS that it’s ok to return RSS files, and how to serve them to the browser.

Here’s how:

  1. Fire up your IIS management console
  2. Select your web site from the list
  3. Right click and select Properties
  4. Click on the HTTP Headers tab
  5. In the MIME Map section, select “File Types”
  6. Select “New Type”
  7. Enter the file extension of your RSS feeds (“.rss”) and “application/rss+xml” as the content type.  “text/xml” should also work, but “application/rss+xml” is more specific.  
  8. Select “Ok” to close the dialog

You probably don’t need to restart your IIS server after this change, but if you’re a pessimist it wouldn’t hurt to restart it anyway.

Now try to access your RSS URL in your browser again. If you still get 404 or other server errors, flush your browser cache and try again.  If the RSS still doesn’t come up in the browser, you need to figure out if you’re using the correct URL for your RSS file.  Virtual domain servers and internal to external directory mappings can sometimes make it difficult to figure out what the external URL is for a file sitting on the web server’s hard disk.  If you can’t find your own RSS feed, chances are slim that PicLens will find it either!

If you now see your RSS feed in the browser, navigate to your HTML page and launch PicLens from your page.  Voila! Your photos are displayed on the PicLens 3D wall thanks to your mediaRSS feed!

Thanks to Kevin and Dwight for passing this tip to me.

  2 Responses to “Serving RSS on IIS”

  1. [...] tagged correctOwn a WordPress blog? Make monetization easier with the WP Affiliate Pro plugin. Serving RSS on IIS saved by 2 others     freefloatinghippy bookmarked on 03/17/08 | [...]

  2. Edited: IIS does have a default MIME type registered for .xml file extensions. IIS doesn’t know what to do with .rss files. A quick fix would be to simply name your rss file with a .xml extension, but I prefer to keep rss in .rss filenames.

Sorry, the comment form is closed at this time.