Friday, September 11, 2009

VPC:s and Shared Networking

I used VPC:s all the time and we often clone VPC:s to all project members. However, there is a very tricky part of VPC:s and Microsoft CRM environments and this concerns SID:s.

As you might know, each windows machine has a SID, which is supposed to be a unique identifier for the machine. Exactly when it is used, I am not certain of but I know that you can get into a whole lot of strange trouble if you have two computers with the same SID on the same LAN.

It can easily be changed on any normal windows machine or server with forinstance the tool newsid. However, there is one type of machine that you cannot change SID on and that is a domain controller.

To ease the managing of normal VPC:s it is usually best to create VPC:s that contain everything in one. That is, Windows server, Domain controller, SQL Server, Reporting Services, Visual Studio 2008 and, of course, CRM.

So, we have several VPC:s that have the same SID and we have people sitting next to eachother running them at the same time. The only network setting that can be selected, to still conect to the internet in the VPC is hence, Shared Networking.

This setting is actually a small local network in it self with a NAT (Network Address Translation)/ DHCP server/switch in the VPC host program.

I noticed a problem today when I started up a VPC and noted that I had forgotten to connect the network cable. After I had inserted the network cable and my host PC had full access, I still had problems getting an IP address and a propper connection to the internet from my VPC.

After some fiddeling with trying to run ipconfig /release, ipconfig /renew and sleeping the VPC, I finally shut down the host program and opened the VPC again after which I ran ipconfig /renew, finally it worked.

My interpretation of this is that the NAT/DHCP server need to have a working network connection in the VPC to intitialize properly. Since I didn't, it just miss started and my VPC:s never got any proper IP:s. The only possible way of restarting it is to restart the VPC host program. After it has been started, you just have to run ipconfig /renew to get a new IP from the VPC DHCP/NAT server.

Gustaf Westerlund
Microsoft Dynamics CRM Architect


Wednesday, September 02, 2009

Problems with referenced assemblies in plugins

Plugins are a very useful technique and can be used to lots of different things. But sometimes things don't work like you expect them to...

Here at Logica Sweden we have developed a CRM Framework with lots of nice tools to aid your everyday CRM development. The architect behind this hasn't been me but my fellow CRM architect Daniel Halan. This framework is contained in a dll and it is used in plugins.

The problem I was facing was that when I updated the framwork and rebuilt my plugins, to the assembly directory, it also put the framework dll in this directory. But when I tried to run it I got the most weird errors saying that it could not find methods, constructors and similar. If I installed the framework dll in the GAC then it would all work fine. This is something that I would like to avoid, however, since it is a bit cumbersome when developing.

After some collective debugging we found the error, plugins don't use the dll:s in the assembly directory, but the dll:s in C:\Program Files\Microsoft CRM\CRMWeb\bin (or similar depending on where you have installed CRM).

So, make sure you put your referenced dll:s in the correct directory and happy coding!

Gustaf Westerlund
Microsoft Dynamics CRM Architect