How to solve error while creating SPsite Object in SharePoint

In this blog we will learn how to solve error while creating SPsite Object in SharePoint.

Let's take a simple scenario - If you are accessing your sharepoint Application through C# Console Application, and while creating SPsite Object , you get the following error
 
"The Web application at http://mysite/site 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 sample piece of code that produces the error  
  1. using (SPSite site = new SPSite(http://http://mysite/site))  -- Throws an exception  
  2. {  
  3. }  
Resolution 
  1. Ensure that you select 3.5 Net Framework in your visual studio environment.
  2. Target of your Application  should be either 64 bit or any CPU  
Happy SharePointing :-)
 
Feel free to provide any suggestions/Improvement on this information shared.