Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.99 KB

README.md

File metadata and controls

59 lines (42 loc) · 1.99 KB

Moesif .NET Framework Example

Moesif is an API analytics platform. Moesif.Middleware is a middleware that makes integration with Moesif easy for .NET applications.

This is an example of NET Framework 4.6.2 application with Moesif integrated running on IIS.

Key files

Moesif Middleware's github readme already documented the steps to setup Moesif Middleware. But here is the key file where the Moesif integration is added:

  • Startup.cs added the Moesif middleware to the pipeline.
  • Settings/MoesifOptions.cs added Moesif middleware related settings.

How to run this example.

  1. Install Moesif Middleware if you haven't done so. Install-Package Moesif.Middleware

  2. Be sure to edit the Settings/MoesifOptions.cs to add your Moesif Application Id.

Your Moesif Application Id can be found in the Moesif Portal. After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.

You can always find your Moesif Application Id at any time by logging into the Moesif Portal, click on the top right menu, and then clicking Installation.

Dictionary<string, object> moesifOptions = new Dictionary<string, object>
      {
          {"ApplicationId", 'Your Application ID Found in Settings on Moesif'},
          {"LogBody", true},
          ...
      }
  1. See HomeController.cs for some sample ASP.NET MVC routes and ProductController.cs for some sample ASP.NET Web API routes that you can test such as the below GET:

Replace the port 59096 with the actual port your app is running on

GET http://localhost:59096/api/product/123

You can also try a POST request:

POST http://localhost:59096/api/product
{
    "Id": 1234,
    "Name": "Chair",
    "Category": "Furniture",
    "Price": 0.0
}

The sample API calls should be logged to Moesif.