This sample demonstrates a .NET 9 Console app, using the NewRelic.Agent
NuGet package. The application runs a BackgroundService
that requests the current weather for Portland, OR (using a free api service) every 5 seconds and writes the JSON response to the console.
- Edit
runSample.ps1
and replace<your-new-relic-license-key>
with your New Relic license key. - Start a Powershell terminal window and navigate to the
samples\console
folder, then run:.\runSample.ps1
- Log in to your New Relic account and look for the
ConsoleSample
app on the APM Summary page (it can take a few minutes). - You can view the logs generated by the New Relic .NET Agent by navigating to the
bin\debug\net9.0\newrelic\logs
folder.
Refer to the .NET Agent Documentation if you need further guidance.