Sunday, September 26, 2010

Connecting to MS CRM 2011 outside the VM

While the CRM 2011 VM created so far works well by itself, you will most likely want to access MS CRM web site, web services and endpoints from outside the VM for development purposes.

To do this you will need to set up VirtualBox to allow access from your host computer.

1. With your VM shutdown, modify the Network Settings and enable the second Adapter. As shown below:

  • Attached to: Host-Only Adapter
  • Name: VirtualBox Host-Only Ethernet  Adapter

image

Note: when a VM is created from scratch it appears to select the correct network adapter type. When I copied the VDI file to my laptop and setup a VM based on that VDI file, it picked a different adapter by default and the networking didn’t work until I made it match the original Network settings that I had when I first configured it.
image 

2. Start up your VM, open up a command prompt and run  ipconfig. Notice the new Local Area Connection 2 should be in your local network. The other is the default NAT adapter that allows your VM to see the Internet as your host computer.

image

3. On your host computer go to C:\Windows\System32\drivers\etc and edit your hosts file and add the new IP address to your hosts file.

image

4.You may want to add a new Credential to your Credential Manager to reduce your login time under Control Panel since you are not in the domain of the VM.

Use the Hosts alias created above, then add a domain\username, and password. This will give you a mostly filled out login when you try to reach the website for the first time.

image

5.  Test the connection out by bringing up MS CRM on your host. I’m using the alias in my hosts file pull up CRM.  http://w2008r2crmdev:5555/CRMDEMO

image

6. Now make sure you can access the endpoints through the browser

http://w2008r2crmdev:5555/CRMDEMO/xrmservices/2011/organizationdata.svc/$metadata 
http://w2008r2crmdev:5555/CRMDEMO/xrmservices/2011/organizationdata.svc/

image

7. If the endpoints show up in the browser than they should be available to add a reference to a Silverlight project as shown below.

VS Service Reference MetaData

Side Note: I have found that this VM is capable of running with 2.3Gb of RAM and on one core on my 2 year old Core Duo laptop. There is just enough memory to run VS 2010 on the host and connect to the guest VM’s endpoints as shown above in the 4Gb of RAM my laptop has. This is by no means an optimum configuration, but it is possible to demonstrate CRM 2011 beta with SharePoint integration and write code against both SDK’s.

2 comments:

Shweta-Amol said...

Thanks for the post Mark!

Unknown said...

Can you help me out here Mark.
I set the Adapter 1 to NAT and Adapter 2 to Virtual Host-Only Ethernet Adapter.

My ipconfig in VM shows these two IPs: 10.0.2.15 and 192.168.56.102;

I set the "192.168.56.102" as "w2008r2crmdev" in hosts file in host machine(Windows 7). Also made the appropriate entry in Windows Credentials.

I cannot browse the crm2011 website from host. But I can browse it within the vm.

My host is connected to a wireless router and IPconfig shows:
Virtual Host-Only: 10.0.0.11 and Wireless LAN:10.0.0.3 with gateway 10.0.01 and subnet mask:255.255.255.0.

Can you suggest wat could be the problem here?