I am trying to access BlockCypher from console Application which works absolutely fine. But when i am trying to access the same MVC Web Application, I am not getting the response from "BlockCypher". not sure why. here is the link i am following:
here is the code i am using
Blockcypher objmain = new Blockcypher("XXXXXXXXXXXXXXX", Endpoint.BcyTest);
objmain.GenerateAddress().Wait();
please help, any idea what i am doing wrong in web.? or what i am missing.
You seem to be hitting a deadlock, instead of using Wait()
in a synchronous context, instead make your action / parent code async and use await
.
public async Task<ActionResult> MyAction()
{
var bc = new Blockcypher("..", Endpoint.BcyTest);
await bc.GenerateAddress();
// ..
}