Its quite often that take backup of site collection and restore it in different machine. Once it done you try to run your code. Problem arise that when you deploy your solution through VS 2010, it gives you the above error.
In order to rectify is just that your current user(from which you are logged on the machine) is in site collection administators.
That user must be in the site collection administrator group.