title: How to report Prometheus-net metrics in ASP.NET 4.7.1
body: <p>How can I use prometheus-net in a regular ASP.NET 4.7.1 application ? In .Net Core is quite easy, but I cannot find a nice way of reporting the metrics to Grafana in 4.7.1</p>
  
  <p>The ideal would be to have path <code>/metrics</code> where the metrics are reported.</p>
  
  <p>I tried to create a rough test controller to run the <code>MetricServer</code> but I get an error.    </p>
  
  <pre><code>// horrible test code
  [RoutePrefix("metrics")]
  public class MetricsController : ApiController
  {
      static readonly MetricServer _server = new MetricServer(7777);
  
      static MetricsController()
      {
          _server.Start();
      }
  
      [Route("")]
      public async Task&lt;IHttpActionResult&gt; Get()
      {
          using (var client = new HttpClient())
          {
              var metrics = await client.GetAsync("http://localhost:7777/metrics");
              return Content(HttpStatusCode.OK, await metrics.Content.ReadAsStringAsync(),null, metrics.Content.Headers.ContentType.ToString());
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>System.Net.HttpListenerException: 'Access is denied'</p>
  </blockquote>