Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Application Using Shared Folder in VirtualBox VM

I've got a VirtualBox VM running Windows Server 2008 R2. The server is configured as a domain controller.

I've got source code on my web application on the host machine. I shared a folder to the guest VM that contains the source code. I configured an IIS application on the Guest machine and pointed it to the share (\VBOXSVR\code).

When I run the application, I get the following message:

Module: IIS Web Core
Notification: BeginRequest
Handler: Not yet determined
Error Code: 0x80070001
Config Error: Cannot read configuration file
Config File: \?\UNC\VBOXSVR\code\web.config

I've verified that the user account the app pool is running under can access the Share. Any ideas on how to fix this?

like image 874
Jared Avatar asked Mar 25 '14 13:03

Jared


People also ask

How do shared folders work in VirtualBox?

To share a host folder with a virtual machine in Oracle VM VirtualBox, you must specify the path of the folder and choose a share name that the guest can use to access the shared folder. This happens on the host. In the guest you can then use the share name to connect to it and access files.


2 Answers

I had a very similar issue when setting up a vagrant box for Windows 2012 R2 with IIS for development purposes. From what I remember I was able to use the following as a workaround, but not something I would want to implement in a production environment:

  1. Make C:\vagrant a network share and set the permissions to be accessible by the user running IIS \\localhost\vagrant.
  2. Set the webroot for site to be the network share \\localhost\vagrant

In theory the following may work for your situation:

  1. Create a symlink to the network share, IE: mklink /j "\\VBOXSVR\code" C:\code\
  2. Make C:\code a network share accessible by IIS, \\localhost\code
  3. Make sure the user running IIS will have permissions to the network share
  4. Set the webroot for the site in IIS to the network share, \\localhost\code

(Optional) I added an entry into the host file (C:\Windows\System32\drivers\etc\host) for localhost. This appeared to improve performance, but it should not be necessary.

Hopefully this will point you in the right direction.

like image 162
dtripler Avatar answered Sep 18 '22 06:09

dtripler


There seems to be an issue with the way Virtualbox shares the folders between Host and Guest. As I discovered when doing this with a Vagrant setup, if you manually create a UNC share on the Host, connect to that share on the Guest and point IIS at it things go along smoothly.

Note that if you are using Application Pools you should ensure the user assigned to the pool can access the share.

If you want to see what a couple of Powershell scripts looks like to automate the process, take a look in the scripts dir of https://github.com/mefellows/vagrant-smb-plugin.

Alternatively, you could use the rsync synced-folder type which has the advantage of much better performance. You could create a local Windows VM with Packer (example templates).

like image 36
Matthew Fellows Avatar answered Sep 17 '22 06:09

Matthew Fellows