The first error I bet every MOSS developer would come across as soon as (s)he runs first manged code on
MOSS 2010 platform would be ...
The Web application at http:// <> could not be found. Verify that you have typed the URL
correctly. If the URL should be serving existing content, the system administrator may need to add a new
request URL mapping to the intended application.
The problem is caused because MOSS 2010 is based on 64 bit platform unlike its previous version which
supported 32 bit too ( Can you imagine how much infrastructure cost it would be for oranisation to purchase new machines?)
There are two setting in Visual Studio 2010 which needs to be configured for this error ...
- Target framework
Right Click on Solution explorer window and click on Application Screen .
Set the Taget Framework to .NET Framework 3.5. Please be aware, you would have 4.0 also
listed if you are running Windows 7. MOSS 2010 does not support .NET 4.0.

2. Platform Target
Right Click on Solution explorer window and click on Build Screen.
Set the Target framework to x64 bit as shown figure...

With these you should be able to run the code smoothly...