Monthly Archives: July 2006

Great article on the riff between software architects and developers

I found this article, Escape Metropolis: Bridging the Divide Between Developers and Architects an interesting read.  I am both an architect and a developer and understand the distrust a developer has for an architect.  Since developers are the ones who produce the actual code they feel they are the real workers. 

I strongly believe an Systems Architect really needs to be an active developer to do a good job and fully understand the problem at hand.  I know I have been in the role of architect and only because I was also a developer could I fully prove what I proposed was the right way to go.  It has happened where the proposed solution ended up being the wrong one and the reason it wasn’t a problem was because it was found in the “proof of concept” phase, which is always needed.

I have posted about this in the past here.

Technorati Tags : ,

My Microsoft Vista Development Environment

Doing software development on the Windows platform, both Windows Forms and Web Development forces us to try out new platforms as they become available.  I have been trying to get a decent virtual machine setup of Microsoft Vista for quite sometime.  I tried various builds in pre-Beta 2 but each one seemed to not do well running under Microsoft Virtual PC. Vista either ran too slow or not at all.

Microsoft recently released the Vista July CTP (build 5472), since it had been a while since I last tried it I figured I would give this build a try.  I setup a virtual machine with 1G of RAM and the maxed out 16G virtual hard disk.  I use Daemon Toolsto allow my MSDN Subscribers 3.4G Vista DVD ISO to be used by Virtual PC.

I started the Vista install off of the DVD ISO and let it run.  It asked my for my license key which came from the MSDN Subscribers site and once entered it took off and ran from there until complete, about an hour later.  I was prompted for a username and password to use for the default user and once created I was prompted to enter it in.  It was interesting what happened next, the screen came up and said it was setting my Personalized Settings, which went on and on.  After waiting for a half hour or so I shut the VM down and tried again but only got to Personalized Settings again.  It turns out the problem was with Vista not refreshing the screen properly when Virtual PC was not in full-screen mode.  Once I did this all was well.   

I wanted to get Vista installed so I could start working with the WinFX also known as .NET Framework 3.0 and “Orcas”.  The technology coming out of Microsoft in this next release looks really promising and as everyone knows, version 3.0 from Microsoft is the killer release.  I found a great blog pointing out which beta bits to use with which operating system you have if you want to start working with the new .NET Framework 3.0, and/or Vista and/or “Orcas”, you can find this information from Tom Archer’s blog.

I am sure anyone reading this blog is well aware of what the next version of the .NET Framework holds for us including; Windows Communication Foundation (WCF aka Indigo), Windows Presentation Foundation (WPF aka Avalon), Windows CardSpace and Windows Workflow Foundation.  You can see details of these at The Microsoft .NET 3.0 Framework Community site.

I installed Visual Studio 2005 on my new Vista VPC, installed some of my small Windows Forms applications and all worked well.  I plan to try out a web project or two in the coming weeks and get a change to start using WCF for some SOA ideas I have.  I will report back my findings too.

I also took the time to play with IE7 on Vista and have to say it is a really nice application that is well laid out and performs as I would expect in a Virtual PC.  All of the web sites I went to, including several I wrote, worked flawlessly in IE7.  I look forward to the release of this browser from Microsoft.

Technorati Tags : , ,

Configuring IIS 6 and ASP.NET to work without a Windows Domain

I recently setup and configured some new web servers for the new web application being rolled out.  The application is an ASP.NET 2.0 application running on IIS6 and Windows 2003.

Our existing application this new application will replace runs in IIS5 and Windows 2000.  The real differentiator is the legacy application is running on a Windows domain and our new application will not.  This decision was made to remove the domain, domain management and the overhead incurred by having a domain in our web application.

The application runs two web servers in a cluster using Microsoft Network Load Balancing.  Load Balancing does just what it says, balances the workload.  This is not all it does, it allows us to take down one server for maintenance while not taking the application down from our clients.  We have a third server that we call our Application Server that runs various “batch” applications for system maintenance.  This server keeps all of our images for the web sites and since this is an eCommerce site we have thousands of product images.  Instead of keeping each image on each server and having to maintain images in more than on location we chose to have a central location and have IIS use a share on our Application Server.

The Problem

There is an inherent problem with this configuration.  By default, IIS 5 runs under the ASP.NET worker process and the default App Pool in IIS6 runs under the NETWORK SERVICE user.   Since we don’t have a domain there is a problem, all of the NETWORK SERVICE accounts are local accounts in each system and have an auto generated password.  This causes a problem in our application when we try to upload images, create new directories or even check for the existence of a file on our web application.

I configured IIS with a virtual directory on another server, which is pretty straight-forward.  We have a Windows share on the other server with permissions for the user we are using to “Connect As” from IIS.  See the below how we indicate a share on another server:


We need to tell IIS what user we want to use to connect to this share:


I am using a user called AppFilesUser, which has to be setup prior on all servers to be used for sharing files, in our case 3.  The user has to have the same password on all the servers as well.  Our web applications display images from the AppFiles share, which work well with this configuration.  The real problem comes into light when we perform certain administrative tasks from the web site that does a Directory.Exists, File.Exists or other Directory.* functions.

I started searching the Internet for possible solutions to my problem and was surprised there was very little posted about this situation.  Even the trusty ASP.NET Forums showed little promise.  Was I wrong in my assumption that this was a good way to go?  Well, maybe but I was not planning on taking the easy way out and simply setup a domain.

The Solution

Any time you come up with a solution to a problem you have to first understand the entire problem completely.   I had said our web site was displaying images fine but when trying to do some simple management we were getting errors in our logs and things were not working. 

The key to understanding what was actually going on relies on how .NET handles certain method calls to the Directory and File classes in particular.  You see, when our web application simply requests an image, IIS just uses the virtual path we specified in our virtual directory to display the file.  This worked for us the first time.  The real problem is how IIS is handling the our calls to Directory.Exists() in our code.  I assumed (yes, I know) IIS was handling the call the same way, through a virtual path but this is NOT the case at all.  Looking at the Directory.Exists() and File.Exists()on MSDN it reveals the obvious problem, both methods use relative or absolute paths, not virtual.   What this means is IIS is using the NETWORK SERVICE account to connect to the AppFiles share to do our business. 

This way IIS is connecting is the real problem here and explains why viewing our images works but simple things like checking for the existence of a file does not.  Since we are not in a domain and the NETWORK SERVICE accounts are all have unique passwords making the ability of the Windows to use pass-through authentication ineffective.  The real solution here is to by-pass the NETWORK SERVICE user and create our own user.  It’s pretty simple once you know how to do it and secure as well.  Since Microsoft did away with the aspnet_wp.exe from IIS5 in IIS6 they decided to use a user who had very little privileges, NETWORK SERVICE.  Since NETWORK SERVICE has so little privileges our user won’t need any special permissions either. 

The steps below are all that is needed to solve this problem:

  1. Create new user on all servers– I called my user AdminWebUser and did this on all of our web servers in our cluster as well as the server actually doing the sharing.
  2. Make the new user a member of the IIS_WPG group – this was a key piece of the puzzle.  The NETWORK SERVICE user is a member of this group with this group having the minimal but needed permissions.
  3. Assign read/write permissions to the share and the directory of the images to the IIS_WPG group– this is done on the server actually housing the images.  Make sure the share and the directory have their permissions set.   If IIS is not on this server then you can just assign the user you created in step 1 to the share and directory.  I also make sure the flags are set so any directories in the path below this directory inherit these permissions.
  4. Create a new App Pool in IIS for this application– this is not required but since I have multiple applications on our servers I wanted to keep these changes isolated.  It is not a bad idea at all to have separate app pools for each application so there is isolation between apps in order to so maintenance, etc.  I won’t explain how to create an app pool here, it’s pretty self-explanatory or you can search on Microsoft’s web site for explicit directions.
  5. Change the identity used by the app pool to the new user created in step 1
  6. Change the app pool used by the web application to the one created in step 4 – this is important and must be done. 

And that’s it!  It took some time to figure all of this out, yes a bunch of trial and error.  I hope I can save you some time and hair pulling.

UPDATE: After several days of running with this configuration I ran into a slight problem.  I am accessing a web service from this web site and the instantation of the local web service proxy class kept failing with the following error in our application (not Windows Application Event log):

Unable to generate a temporary class (result=1). error CS2001: Source file ‘C:\WINDOWS\TEMP\z3wfukwd.0.cs’ could not be found error CS2008: No inputs specified

It turns out when changing the user our App Pool was running under there happens to be some services that use the temp directory.  If you look on your Windows 2003 system you will see that NETWORK SERVICE has special rights to this directory instead of the IIS_WPG group, which I found strange.  Once I added IIS_WPG to the permissions list for the temp directory and matched those of NETWORK SERVICE, the calls to the web service worked again.

Technorati Tags : ,

Great C# String.Format Resource

I came across a great C# String.Format resource from Steve Tibbett and figured I would share it.  I can never seem to remember the all the little curly brace format strings when I use String.Format. 


Technorati Tags : ,

ELMAH for ASP.NET 2.0 Available

I have been using a module for Error Logging and Notification released on GotDotNet, called ELMAH.  ELMAH is a great behind-the-scenes module for ASP.NET that is quickly added to your project’s /bin folder, add a handler in your web.config and run a script to create a table in your database.  

ELMAH logs errors to my SQL Server Database and allows me to quickly know if an error has occurred.  I can also configure the module to email me to get early notification.  I have been using ELMAH for the past year or so and would be lost without it.  The latest release is built for ASP.NET 2.0.  I used the one built for ASP.NET 1.1 without any problems.  The new version has some nice updates like using System.Net.Mail instead of the troublesome CDONTS.

Here you can see a sample of the error reporting:


Please give ELMAH a try, it’s well worth the few minutes to set it up.

Technorati Tags:

Business of Software by Eric Sink

I have had some down time lately and got the chance to put in some solid time to read a book.  I am always reading, mostly technical books, but never really one I read cover to cover.  So, I decided to read “The Business of Software” by Eric Sink.  I work for a company who writes software used for themselves internally and externally for clients.  Yes, all software is pretty much for clients.

Eric’s book is primarily a collection of blog posts from the authors web log over the years while building his company, SourceGear.  The book is broken down into 4 sections with various subtopics under each. 

  • Part One – Entrepreneurship
  • Part Two – People
  • Part Three – Marketing
  • Part Four – Sales

Much of the book talks about how SourceGear was built and the decisions that went into many aspects of his company and how these decisions may or may not have been different if given the chace.  Eric starts each chapter with a little insite into each blog post, what it means or other introduction.

I think the book was worth the read and does give some good insite.  I have read many of the posts on Eric’s blog but some where his earlier work and I welcomed the chance to read those.  Overall I liked the book but there were some thinks repeated from one chapter to another that felt out of place and may be a result of cutting and pasting.  I would recommend this book.

A book with a very similiar format is Joel on Software by Joel Spolsky of Fogcreek Software, also worth a read.

Technorati Tags:

Online Database Schema Library

I came across this Library of Free Database Models from Scott Guthrie’s blog recently.  Below is an example of one design I did in the past months this source would have been extremely helpful.

If you are starting a new project of expanding one this resource should prove to be a great place to start when thinking about your schema design.


Technorati Tags : ,