I ran into the same issue and finally found the solution. Effectively what the error is telling you is that the iphlpapi.dll assembly does not exist in the Lambda execution environment. This is the system level assembly that gets pinvoked from HttpClient to handle the actual TCPIP requests. In researching this issue, I found that AWS Lambda's run in an AWS Linux AMI environment. Obviously, a windows system assembly will not be available.
Diving into .Net core, there is an ability to target the runtime environment and build your .Net core for the specific environments. This is only really needed for pulling in the correct system level dependencies from nuget.
The solution was to add a runtimes node to my project.json that included a linux target. .Net does not have a target specifically for AWS Linux AMI so I just used an Ubuntu.14.04-64 target and that seemed to work.
"runtimes": {
"ubuntu.14.04-x64": {},
"win10-x64": {}
}
The other hurdle to get around is that VS does not seem to allow me to compile for the ubuntu runtime, so I had to drop to the command line and use the DotNet CLI. Navigate to your project directory and issue the following commands:
dotnet restore
dotnet publish -c release -r ubuntu.14.04-x64
This will get all of the appropriate nuget dependencies for Ubuntu and then build your project for ubuntu. All of the assemblies will be placed in the /bin/release/netcoreapp1.0/ubuntu.14.04-x64/publish directory. Just zip up these files and you can then upload this package to your Lambda function.
Note: I was not able to get the AWS toolkit function window to upload my file so I had to resort to uploading it from the AWS console website.
Once I finished uploading the new package, everything worked as expected and I no longer get the error.