RoutesList ist ein praktisches Tool, mit dem Sie alle Routen in Ihrer .NET -Anwendung auf klare und präzise Weise sehen können. Sie können die Methoden, URIs, Controller, Aktionen und Middleware Ihrer Routen problemlos inspizieren und die Ausgabe an Ihre Anforderungen anpassen. RoutesList funktioniert mit .NET Core App 3.1, .NET5.0, .NET 6, .NET7.0, Razor Pages, ASP.NET MVC und Blazor Server -Projekten.
Kompatibel mit:




Von nuget.org
Install-Package RoutesList Fügen Sie einfach services.AddRoutesList zu Service ConfiguresVice -Methode hinzu.
Beispiel:
Startup.cs
\ .. .
public void ConfigureServices ( IServiceCollection services )
{
\ .. .
services . AddRoutesList ( ) ;
}und hinzufügen, um die Methode zu konfigurieren
Beispiel:
Startup.cs
\ .. .
public void Configure (
IApplicationBuilder app ,
IWebHostEnvironment env ,
)
{
\ .. .
app . UseRoutesList ( ) ;
} Standardendpunkt: http://your_application_address/routes
Beispiel:
Programm.cs
using RoutesList . Gen ;
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddRoutesList ( ) ; < -- usage
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) ) {
app . UseExceptionHandler ( "/Error" ) ;
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseRouting ( ) ;
app . UseAuthorization ( ) ;
app . MapRazorPages ( ) ;
app . UseRoutesList ( ) ; < -- usage
app . Run ( ) ;
public partial class Program { } public class Program
{
public static void Main ( string [ ] args )
{
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddServerSideBlazor ( ) ;
builder . Services . AddSingleton < WeatherForecastService > ( ) ;
builder . Services . AddRoutesList ( ) ;
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) ) {
app . UseExceptionHandler ( "/Error" ) ;
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseRouting ( ) ;
app . MapBlazorHub ( ) ;
app . MapFallbackToPage ( "/_Host" ) ;
app . UseRoutesList ( options => {
options . SetAppAssembly ( typeof ( Program ) . Assembly ) ; < -- setup current application webassembly with blazor component
} ) ;
app . Run ( ) ;
}
} In App.UseroutesList können Sie Optionen übergeben
| Name | Beschreibung |
|---|---|
| Endpunkt | Endpunktname |
| Titel | Titel für die Website |
| Siedlungen | Fügen Sie Vorlagenklassen für die Tabelle hinzu |
| SetAppassembly | Stellen Sie die aktuelle Anwendungsbaugruppe zusammen mit Blazor -Komponente ein |
Startup.cs
public void Configure (
IApplicationBuilder app ,
IWebHostEnvironment env ,
)
{
IDictionary < string , string [ ] > dict = new Dictionary < string , string [ ] > ( ) ;
string [ ] classes = dict [ "table" ] = new string [ 2 ] { "table" , "table-striped" } ;
app . UseRoutesList ( options => {
options . Endpoint = "your_new_endpoints" ;
options . Tittle = "Your new Title for site" ;
options . SetTableClasses ( classes ) ;
options . SetAppAssembly ( typeof ( Program ) . Assembly )
} ) ;
}Programm.cs
var builder = WebApplication . CreateBuilder ( args ) ;
// Add services to the container.
builder . Services . AddRazorPages ( ) ;
builder . Services . AddControllersWithViews ( ) ;
var app = builder . Build ( ) ;
// Configure the HTTP request pipeline.
if ( ! app . Environment . IsDevelopment ( ) )
{
app . UseExceptionHandler ( "/Error" ) ;
app . UseHsts ( ) ;
}
app . UseHttpsRedirection ( ) ;
app . UseStaticFiles ( ) ;
app . UseAuthorization ( ) ;
app . MapGet ( "/hi" , ( ) => "Hello!" ) ;
app . MapDefaultControllerRoute ( ) ;
app . MapRazorPages ( ) ;
app . UseRoutesList ( options => {
options . Endpoint = "your_new_endpoints" ;
options . Tittle = "Your new Title for site" ;
options . SetTableClasses ( classes ) ;
options . SetAppAssembly ( typeof ( Program ) . Assembly )
} ) ;
app . Run ( ) ; Beiträge sind immer willkommen, egal ob Sie neue Funktionen, Fehlerbehebungen hinzufügen/vorschlagen, neue Dateiformate dokumentieren oder einfach eine Grammatik bearbeiten. Erstellen Sie ein neues GitHub -Problem und beschreiben Sie Ihr Problem und fügen Sie das Problem -Tag für Fehler/Verbesserung hinzu