Request/response Inspector middleware for ASP.NET Core. like Glimpse.
Rin captures HTTP requests to ASP.NET Core app and provides viewer for captured data. It's useful tool to debug your Web application (e.g. Web sites, API apps).
Rin captures HTTP traffics between the ASP.NET Core app and any clients.
- Headers + Body
- Traces (
Microsoft.Extensions.Logging.ILogger
, log4net, ...) - Unhandled Exception
Rin inspector displays events that occurred while processing a request.
Rin inspector can display request and response body with a preview. (e.g. JSON, Image, HTML, JavaScript ...)
Rin captures a request and response. Also, it captures logs while processing a request.
- Built-in
Microsoft.Extensions.Logging.ILogger
integration - log4net Appender
You can replay a request easily using cURL and LINQPad.
- Save request/response body
- Copy request as cURL and C#
- Record timings of view rendering and action execution
- In-View Inspector (like MiniProfiler)
- .NET Core 3.1+
- ASP.NET Core 3.1+
- Modern browser (e.g. Microsoft Edge, Google Chrome, Firefox, Safari...)
- WebSocket connectivity
Dependencies
-> Manage NuGet Packages...
-> Search and install Rin
and Rin.Mvc
(if your project is built with ASP.NET Core MVC) package.
dotnet add package Rin
dotnet add package Rin.Mvc
Install-Package Rin
Install-Package Rin.Mvc
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(configure =>
{
// Add: Enable Rin Logger
configure.AddRinLogger();
})
.UseStartup<Startup>();
public class Startup
{
...
public void ConfigureServices(IServiceCollection services)
{
...
services.AddControllersWithViews()
// Add(option): Enable ASP.NET Core MVC support if the project built with ASP.NET Core MVC
.AddRinMvcSupport();
// Add: Register Rin services
services.AddRin();
}
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
// Add: Enable request/response recording and serve a inspector frontend.
// Important: `UseRin` (Middlewares) must be top of the HTTP pipeline.
app.UseRin();
// Add(option): Enable ASP.NET Core MVC support if the project built with ASP.NET Core MVC
app.UseRinMvcSupport();
app.UseDeveloperExceptionPage();
// Add: Enable Exception recorder. this handler must be after `UseDeveloperExceptionPage`.
app.UseRinDiagnosticsHandler();
}
...
}
}
@inject Rin.Mvc.View.RinHelperService RinHelper
...
<environment include="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
@* Add: Enable In-View Inspector for ASP.NET Core MVC *@
@RinHelper.RenderInViewInspector()
</environment>
...
Launch the app, then open https://[Host:Port]/rin/
in the browser, you can see Rin Inspector now.
Rin Inspector (client side) codes is separated from Rin core C# project. If you want to develop Rin (C#) or launch a sample project, you need to build and deploy the artifacts.
yarn
yarn start
yarn build
yarn pack
yarn build
copy .\dist\static\main.js* ..\Rin.Mvc\EmbeddedResources\