I'm trying to use Asp.NET WebAPI module but I get a weird error. When I try to run this simple program:
class Program
{
static void Main(string[] args)
{
System.Net.Http.HttpClient client = new HttpClient();
string data = client.GetStringAsync("http://www.kralizek.se/").Result;
Console.WriteLine(data);
Console.ReadLine();
}
}
I have this error.
System.MissingMethodException was unhandled
Message=Method not found: 'System.Threading.Tasks.Task`1<System.String> System.Net.Http.HttpClient.GetStringAsync(System.String)'.
Source=Connector.App
StackTrace:
at ConnectorApp.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The error occurs in Visual Studio and in LinqPad but it doesn't occur to my colleague.
I thought there could have been some kind of conflict with .NET 4.5 dev preview so I uninstalled it but without any benefit.
Thanks