colinramsay.co.uk

Getting IIS 7.5 (in VirtualBox and VMWare) to Serve Sites from an OSX Share

24 Sep 2009

A longwinded title, but this is mostly as a note for me. Assuming your Mac's IP address is 192.168.1.101:

  1. You need matching users with matching passwords on both Windows and OSX. So, your main user on OSX is u:colin/p:password. You need a user on Windows u:colin/p:password. Casing is important!
  2. Enable SMB on OSX from File Sharing
  3. Share the OSX folder you want to serve up (let's say it's named "mysite")
  4. Create a new site in IIS with the physical path as \\192.168.0.101\mysite

The first point is key, as is using the UNC path in the last point, rather than a mapped drive. I used this Stack Overflow question to get this up and running.

Update: I just tried to run some unit tests via the Resharper test runner and received a security exception. The following fixed the issue:

caspol -m -ag 1 -url “file://\\192.168.0.101\mysite\*” FullTrust -exclusive on

This post from backroom security tech and also this from .NET security blog helped here.

Update 2: In a new VMWare VM, I came across two additional problems. Using " around the URL caused caspol to throw an error, and having spaces in the URL doesn't work - replace them with %20.

Update 3: In some cases, such as writing across the UNC share to the virtual directory your site is running in, you may need to set up Impersonation in the web.config with your matching user. You may additionally need to set the AppPool identity to that shared user. Note that I now have this system working in VMWare Fusion.