Kestrel error on a netcore web api app on a dev machine but not on another
<p>I am having an error when excecuting a netcore WebApi aplication, the weird thing is that it does run ok on another machine.</p>

<p>Here is the console information when I call the method that causes the error:</p>

<pre><code>info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 1640.1033ms 200
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET http://localhost:5000/api/weather/provider/1/latitude/37.8267/longitude/-122.423
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Executing action method WeatherServices.Controllers.WeatherController.Get (WeatherServices) with arguments (1, 37.8267, -122.423) - ModelState is Valid 
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HKTG39DAMIHF": An unhandled exception was thrown by the application.
System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.) ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at WeatherServices.WeatherApiWrappers.Wunderground.Wunderground.&lt;GetLocalWeather&gt;d__6.MoveNext() in C:\Workspace\ChathamWeatherAPI\WeatherServices\WeatherApiWrappers\Wunderground\Wunderground.cs:line 37
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at WeatherServices.Controllers.WeatherController.Get(Int32 source, String latitude, String longitude) in C:\Workspace\ChathamWeatherAPI\WeatherServices\Controllers\WeatherController.cs:line 50
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeActionFilterAsync&gt;d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.&lt;InvokeAsync&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.&lt;Invoke&gt;d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.&lt;Invoke&gt;d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.&lt;RequestProcessingAsync&gt;d__2.MoveNext()
---&gt; (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
   at WeatherServices.WeatherApiWrappers.Wunderground.Wunderground.&lt;GetLocalWeather&gt;d__6.MoveNext() in C:\Workspace\ChathamWeatherAPI\WeatherServices\WeatherApiWrappers\Wunderground\Wunderground.cs:line 37&lt;---

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 526.1252ms 200
</code></pre>

<p>From that it seems the error has to do with one of the async methods of the program, but I don't get why, and why it would work on another machine.</p>

<p>project.json:</p>

<pre><code>{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.Extensions.Caching.Memory": "1.0.0-*",
    "RestClientHelper": "1.0.0-*"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },

  "tooling": {
    "defaultNamespace": "WeatherServices"
  }
}
</code></pre>

<p>Method that triggers the error, the error happens on the return statement:</p>

<pre><code>    public async Task&lt;IList&lt;Forecast&gt;&gt; GetLocalWeather(double latitude, double longitude)
    {
        var url = $"http://{Domain}/api/{ApiKey}/forecast10day/q/{latitude},{longitude}.json";
        var result = await _restApiCaller.CallListEndPoint(url);

        //Limit the query to 8 days
        return result.Forecast.Txt_Forecast.ForecastDay.Where(day =&gt; day.Period &lt; 16)
            .Select(day =&gt; day.MapToForecast()).ToList();
    }
</code></pre>