Caching Images in IIS 6.0

Yahoo posted a list of rules for improving the performance of your web site, along with a new FireFox-based tool for diagnosing your site's performance, called YSlow.

Their number one rule is to reduce the number of HTTP requests, and this only makes sense. I'll bet most of us ASP.NET developers are well aware of output caching, and how to do this in code. But what about those static files, like images and scripts? Well, there is an IIS setting for that. It's easy to do, and the payoff can be big if you have a very graphic-intense site. Here's what you do for IIS 6:

  1. Open the IIS Management console
  2. Find the directory containing your images (static content only)
  3. Right click the directory, and choose Properties.
  4. Click the HTTP Headers tab.
  5. Check the Enable Content Expiration check box.
  6. Click the Expire After radio button, and choose an interval.
  7. Click the OK button. Done!

The downside is that you won't get the payoff for the first time a user visits the site, but other pages using the same resources will be much snappier. Be aware that caching dynamically created content this way can cause some strange issues, so take care as to what you cache. As always, test it well before you release it and you will be rewarded.

Posted: Monday, August 20, 2007 4:11:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
IIS | Performance

Speaking at West Michigan Dot Net User Group - WCF

I will be speaking on July 17th on Windows Communication Foundation. See the West Michigan .NET Users Group site for details.

Posted: Saturday, July 07, 2007 9:59:20 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
.Net 3.0 | Speaking | WCF

Web Services Authentication Gotcha

We had code in an ASP.NET page trying to call the Commerce Server Profiles web service that resides on the same physical box. The credentials we used were appropriately configured for Commerce Server using AzMan. For some reason, the code was failing with a 401: Unauthorized error. No matter what credentials we used, no luck. But if you ran the code from another box, it worked fine. Same credentials pointing to the service on that box, no errors.

Turns out the hosts file had an entry for the DNS name we were using, and mapped that name to 127.0.0.1, the loopback address. This was the gotcha. Apparently there is a loopback security feature that causes this behavior. There is a support article describing the effect. Essentially it is a security check to keep certain kinds of attacks at bay. The article suggests registry changes to disable it, but we took a different route.  In the short term, if the calling code accessed the web service via IP address (NOT 127.0.0.1) instead of DNS name the problem was circumvented. Meanwhile the network guru is working to get the actual DNS resolution to work.

Posted: Tuesday, July 03, 2007 11:45:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
ASP.NET | Commerce Server | Security

Sql Server Fix Logins

Sometimes when copying databases, for instance from production down to development, the user accounts become dysfunctional. The database login no longer matches the overall server login. To re-synchronize them use:

exec sp_change_users_login auto_fix, 'someusername'

Posted: Tuesday, June 05, 2007 10:12:17 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
SQL Server

Even More WCF Links

Articles by Juval Lowy

Aaron Skonnard's Wiki

WCF Developer Center on MSDN

Posted: Friday, May 18, 2007 5:54:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
.Net 3.0 | WCF

Speaking at West Michigan Day of .Net

I will be speaking at the West Michigan Day of .Net on May 19th in Grand Rapids, MI at Davenport University.

My talk is Introduction to WCF. WCF is certainly the understated pillar of .Net 3.0. There is a ton of great content all day long, and best of all it's FREE! This is a great opportunity, don't miss out.

WM Day of .Net May 19, 2007 - I'll be there!

Posted: Tuesday, April 10, 2007 3:57:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Speaking | WCF

More Good WCF Links

The Server Side .Net has a good WCF link aggregation.
Posted: Wednesday, April 04, 2007 3:48:30 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
WCF

More SelfSSL Issues

I blogged previously about some issues with SelfSSL and multiple web sites. A colleague of mine, Charles Medcoff, blogs about a related problem with SelfSSL and SQL Server.
Posted: Wednesday, March 28, 2007 4:39:17 AM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Security | SQL Server