If you want to develop using Sublime Text (or other) on Mac but your company uses ASP.NET MVC for back-end server, this information may be helpful to get you to where you can have a shared drive in from Mac to a VM. Build using Visual Studio in the VM, but develop using the Mac.
These instructions are Parallels specific, but should be very similar for other VM hosts.
Set up a static ip address on your Virtual Machine
- In Windows, go to Control Panel > Network and Internet > Network and Sharing Center
- Click “Ethernet” under the active networks section.
- Click the “Properties” button.
- Scroll down and highlight “Internet Protocol Version 4 (TCP/IPV 4)”
- Click the “Properties” button
- Select the “Use the following IP address:” option and use the following (exactly)
- IP Address: 10.211.55.3
- Subnet Mask: 255.255.255.0
- Default Gateway: 10.211.55.1
- Preferred DNS Server: 10.211.55.1
- Alternate DNS Server: (leave this one blank)
Add to hosts
On your Mac, edit /etc/hosts file
Add the following line, with your VM guest IP address from the previous step:
10.211.55.3 localhost
Install IIS on Windows
This has been documented a thousand places. I followed these instructions
Enable .NET
- Type
appwiz.cpl
into Run (WIN +R) - On the left hand side click on the “Turn Windows features on or off” link.
- Now expand Internet Information Services > World Wide Web Services > Application Development Features.
- Place a check next to
ASP.NET 4.6
(or your version) which will also check 3 other boxes. - Click OK.
Install URL Rewrite 2.0
- Download and install the Web Platform Installer on Windows
- Once it instals and opens, search for
URL Rewrite 2.0
- Click the Add button
- Down below, click the Install button
- Accept the terms
Enable Network Sharing
Windows 8:
- Open File Explorer
- Click the Network shortcut on the left column
- When prompted click the little yellow bar at top “Click to change”
- Select “Turn on network discovery and file sharing”
- Select the “No” option.
Windows 10:
- Settings > Network & Internet > Ethernet
- Click the blue Network Icon (Network Connected) under the Ethernet title
- Turn the switch to on.
- Restart
Configure your web server
- In IIS Manager, go to your Default Web Site under Sites.
- Click Basic Settings from the column on the right.
- Select the DefaultAppPool.
- Point the Physical Path your Web project folder. (something like \\Mac\Share\repo\Project.Web)
- Click OK
Turn off Private Network firewall
- In Windows 8: Go to Control Panel > System and Security > Windows Firewall > Turn Windows Firewall on or off. In Windows 10: Go to Settings > Network and Internet > Ethernet (left tab) > Windows Firewall > Turn Windows Firewall on or off.
- Under Private network settings, choose to Turn off Windows Firewall
- Click OK.
Build
Build the code in Visual Studio
Test
- test to see if you can access the content from within the Virtual Machine
- If that works, try it from your Mac
Viewing Changes
- Any server code (C#, .NET, Razor) changes made to the app will require the DefaultAppPool to be Recycled before they will appear in your browser on the mac.
- Fire up IIS Manager by typing
inetmgr
into Run (WIN + R) - Select Application Pools > DefaultAppPool
- Choose Recycle in the right column (note: recycle happens very fast)
- Refresh the browser (this usually takes a moment or two after a recycle)
Troubleshooting
- Build Clean Solution
- Build Rebuild Solution
- Restart the app pool
- Make sure your mapped drive > repo directory isn’t marked as read only
- right click your repo directory > properties
- if read only is marked, uncheck it and apply to all sub-folders and files.