Check the serial number in about us in VM. If it is not there or it is 0. Then below solution will definitely fix your problem.
VirtualBox does not by default make a serial number available to OS X guests. Of course OS X runs just fine inside VirtualBox running on a Mac even in that case. But due to the serial number being “0” the App Store and Server applications will not work.
The solution is to determine the serial number of the real Mac by opening About This Mac or running System Information. It is an alphanumeric string. On my Mac Pro 5,1 it begins with a letter and is 11 characters long.
In Terminal run the following command substituting the name of your VirtualBox virtual machine and your serial number (all one line):
VBoxManage setextradata “<your-vm-name>” VBoxInternal/Devices/efi/0/Config/DmiSystemSerial “<your-serial-number>“
Make sure you remove the quotes while entering the above command.
Starting up the machine after this change will then present a serial number that matches the base system and applications will function correctly.
This was tested on a Mac Pro 5,1 running 10.10.5 with VirtualBox 5.0.14. The guest was 10.11.3.