'Appinsights dependency inject in razor page with no controller
If I have an asp.net core razor page, with no controller, how do I hook the dependency injection as suggested in
and
The code as follows runs but the events are never written when I use the dependency injections methods for .net core. Other regular app insights events process fine.
namespace simplewebapp.Pages { public class IndexModel : PageModel { private readonly ILogger _logger; private TelemetryClient telemetry; public IndexModel(ILogger logger, TelemetryClient telemetry) { _logger = logger; this.telemetry = telemetry; telemetry.TrackEvent("IndexPage_IndexModel"); }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
