CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Steve Hebert's Development Blog

Steve's Blog - From .Net to dotMath and everything in between.

Fun with NAS devices and IIS

I keep running into an interesting condition with an EMC NAS device.  Part of our web front-end reads and writes files to an external EMC NAS device shared among the clustered web servers.  When using a Samba-based NAS device, we configure IIS to run under a username / password that also exists on the NAS device.  We then impersonate the account settings in ASP.NET using the web.config file. At this point, we can read/write to the device using UNC paths. (This solution is documented on MSDN several times, with the best code example I've found here - even though it's classic ASP).

This works great on the Samba device, but it does not work on the EMC device.

Here’s the kicker – in order to get the EMC device working, we must pass the UNC along with username and password to WNetAddConnection2A.  Even worse, we occasionally get a “Fatal Network Error” exception thrown when doing reads and writes. My guess on this one is that an existing open connection’s access token is invalidated by a subsequent call to WNetAddConnection2A by another IIS thread.  I wonder if this explains why Windows Explorer refuses to allow different authentication credentials once you’ve successfully mapped a drive to a given server?  

 

Update...

 

The solution to this problem is using NFS support in Windows Services for Unix.  It looks like file handling is subtly different and problems can arise.  WS4U is a free download from Microsoft and it sounds like they'll be baking this into the operating system over time.



Comments

Eric Newton said:

I'd be interested to hear the solution to this...

I've had similar issues when working on a very similar problem of having a cluster of web servers all tied into a single back-end file share (which ironically kills the uptime since that fileshare becomes a single point of failure) but hey, not everything's perfect :-)
# September 12, 2005 1:22 AM

Steve Hebert's Development Blog said:

I blogged about some problems we were having with an EMC NAS device and file locking with C#/.Net. ...
# September 14, 2005 11:35 AM
Check out Devlicio.us!

Our Sponsors

Free Tech Publications