Skip to content

Fast.NET.Core 公开 API

目标 net8.0;net9.0;net10.0。本页为语法声明与 XML 注释参考,运行示例和边界见模块用法

源码提交:43554c07f6c216f80b509bd535c0a5b66ae7f2e8。维护流程:scripts/export-dotnet-api.ps1;普通站点构建直接消费此文件。

Fast.NET.Core.DaySentenceInfo

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public class DaySentenceInfo

每日一句信息

Fast.NET.Core.DaySentenceInfo.Picture2

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string Picture2 { get; set; }

图片 2

Fast.NET.Core.DaySentenceInfo.Caption

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string Caption { get; set; }

说明

Fast.NET.Core.DaySentenceInfo.Note

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string Note { get; set; }

内容

Fast.NET.Core.DaySentenceInfo.Content

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string Content { get; set; }

英文内容

Fast.NET.Core.DaySentenceInfo.ShareImg

源码 · 目标:net8.0、net9.0、net10.0

csharp
[JsonPropertyName("fenxiang_img")]
    public string ShareImg { get; set; }

分享图片

Fast.NET.Core.DaySentenceInfo.DateTime

源码 · 目标:net8.0、net9.0、net10.0

csharp
[JsonPropertyName("dateline")]
    public DateTime DateTime { get; set; }

时间

Fast.NET.Core.DiskInfo

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public class DiskInfo

磁盘信息

Fast.NET.Core.DiskInfo.DiskName

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string DiskName { get; set; }

磁盘名

Fast.NET.Core.DiskInfo.TypeName

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string TypeName { get; set; }

类型名

Fast.NET.Core.DiskInfo.TotalFree

源码 · 目标:net8.0、net9.0、net10.0

csharp
public decimal TotalFree { get; set; }

总剩余

Fast.NET.Core.DiskInfo.TotalSize

源码 · 目标:net8.0、net9.0、net10.0

csharp
public decimal TotalSize { get; set; }

总量

Fast.NET.Core.DiskInfo.Used

源码 · 目标:net8.0、net9.0、net10.0

csharp
public decimal Used { get; set; }

已使用

Fast.NET.Core.DiskInfo.AvailableFreeSpace

源码 · 目标:net8.0、net9.0、net10.0

csharp
public decimal AvailableFreeSpace { get; set; }

可使用

Fast.NET.Core.DiskInfo.AvailablePercent

源码 · 目标:net8.0、net9.0、net10.0

csharp
public decimal AvailablePercent { get; set; }

使用百分比

Fast.NET.Core.FastContext

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class FastContext

App 上下文

Fast.NET.Core.FastContext.WebHostEnvironment

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IWebHostEnvironment WebHostEnvironment { get; internal set; }

获取 Web 主机环境

Fast.NET.Core.FastContext.HostEnvironment

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IHostEnvironment HostEnvironment { get; internal set; }

获取主机环境

Fast.NET.Core.FastContext.InternalServices

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IServiceCollection InternalServices { get; internal set; }

应用服务

Fast.NET.Core.FastContext.WebApplication

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IApplicationBuilder WebApplication { get; set; }

应用程序构建器

Fast.NET.Core.FastContext.RootServices

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IServiceProvider RootServices { get; internal set; }

存储根服务,可能为空

Fast.NET.Core.FastContext.Configuration

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IConfiguration Configuration { get; internal set; }

应用配置

Fast.NET.Core.FastContext.HttpContext

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static HttpContext HttpContext { get; }

请求上下文

Fast.NET.Core.FastContext.GetService

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static TService GetService<TService>(IServiceProvider serviceProvider = null) where TService : class

获取请求生存周期的服务

  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 类型参数 TService:服务类型
  • 返回:获取到的请求生存周期的服务

Fast.NET.Core.FastContext.GetService

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static object GetService(Type type, IServiceProvider serviceProvider = null)

获取请求生存周期的服务

  • 参数 type:目标类型
  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 返回:获取到的请求生存周期的服务

Fast.NET.Core.FastContext.GetServices

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IEnumerable<TService> GetServices<TService>(IServiceProvider serviceProvider = null) where TService : class

获取请求生存周期的服务集合

  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 类型参数 TService:服务类型
  • 返回:获取到的请求生存周期的服务集合集合

Fast.NET.Core.FastContext.GetServices

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IEnumerable<object> GetServices(Type type, IServiceProvider serviceProvider = null)

获取请求生存周期的服务集合

  • 参数 type:目标类型
  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 返回:获取到的请求生存周期的服务集合集合

Fast.NET.Core.FastContext.GetRequiredService

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static TService GetRequiredService<TService>(IServiceProvider serviceProvider = null) where TService : class

获取请求生存周期的服务

  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 类型参数 TService:服务类型
  • 返回:获取到的请求生存周期的服务

Fast.NET.Core.FastContext.GetRequiredService

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static object GetRequiredService(Type type, IServiceProvider serviceProvider = null)

获取请求生存周期的服务

  • 参数 type:目标类型
  • 参数 serviceProvider:用于解析服务的服务提供器;为 null 时使用当前请求或根服务提供器
  • 返回:获取到的请求生存周期的服务

Fast.NET.Core.FastContext.GetConfig

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static TOptions GetConfig<TOptions>(string path = null) where TOptions : class, new()

获取配置

  • 参数 path:配置中对应的 Key
  • 类型参数 TOptions:配置选项类型
  • 返回:获取到的配置

Fast.NET.Core.FastContext.GetOptions

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static TOptions GetOptions<TOptions>() where TOptions : class, new()

配置选项

  • 类型参数 TOptions:配置选项类型
  • 返回:配置选项

Fast.NET.Core.FastContext.GetServiceLifetime

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static ServiceLifetime? GetServiceLifetime(Type serviceType)

获取服务注册的生命周期类型

  • 参数 serviceType:要查询的服务类型
  • 返回:获取到的服务注册的生命周期类型

Fast.NET.Core.CorsAccessorExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class CorsAccessorExtension

提供跨域处理扩展方法

Fast.NET.Core.CorsAccessorExtension.AddCorsAccessor

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static WebApplicationBuilder AddCorsAccessor(this WebApplicationBuilder builder)

添加跨域服务

  • 参数 builder:要配置的应用构建器
  • 返回:返回 builder,便于链式调用

Fast.NET.Core.CorsAccessorExtension.AddCorsAccessor

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IServiceCollection AddCorsAccessor(this IServiceCollection services, IConfiguration configuration,
        string section = "CorsAccessorSettings")

添加跨域服务

  • 参数 services:要添加服务的服务集合
  • 参数 configuration:用于读取模块设置的配置
  • 参数 section:JSON 配置文件节点的 Key 默认值:CorsAccessorSettings
  • 返回:返回 services,便于链式调用

Fast.NET.Core.CorsAccessorExtension.AddCorsAccessor

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IServiceCollection AddCorsAccessor(this IServiceCollection services,
        Action<CorsAccessorSettingsOptions> optionAction)

添加跨域服务

  • 参数 services:要添加服务的服务集合
  • 参数 optionAction:跨域访问配置操作
  • 返回:返回 services,便于链式调用

Fast.NET.Core.GzipCompressionExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class GzipCompressionExtension

提供 Gzip 压缩扩展方法

Fast.NET.Core.GzipCompressionExtension.AddGzipCompression

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IServiceCollection AddGzipCompression(this IServiceCollection services)

添加 Gzip 压缩

  • 参数 services:要添加服务的服务集合
  • 返回:返回 services,便于链式调用

Fast.NET.Core.GzipCompressionExtension.UseGzipCompression

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IApplicationBuilder UseGzipCompression(this IApplicationBuilder app)

启用 Gzip 压缩

  • 参数 app:要配置的应用管道
  • 返回:返回 app,便于链式调用

Fast.NET.Core.HttpContextExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class HttpContextExtension

HttpContext 提供扩展方法

Fast.NET.Core.HttpContextExtension.GetRequestMethod

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static HttpRequestMethodEnum GetRequestMethod(this HttpContext httpContext)

获取请求方式

  • 参数 httpContext:当前请求上下文
  • 返回:获取到的请求方式;当前请求上下文为空时返回 HttpRequestMethodEnum.Unknown

Fast.NET.Core.IApplicationBuilderExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class IApplicationBuilderExtension

IApplicationBuilder 提供扩展方法

Fast.NET.Core.IApplicationBuilderExtension.EnableBuffering

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IApplicationBuilder EnableBuffering(this IApplicationBuilder app)

启用 Body 重复读功能

说明:须在 app.UseRouting() 之前注册

  • 参数 app:要配置的应用管道
  • 返回:返回 app,便于链式调用

Fast.NET.Core.IApplicationBuilderExtension.UseMapHub

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IApplicationBuilder UseMapHub(this IApplicationBuilder app)

启用集线器

说明:须在 app.UseRouting() 之后注册

  • 参数 app:要配置的应用管道
  • 返回:返回 app,便于链式调用

Fast.NET.Core.IConfigurationExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class IConfigurationExtension

IConfiguration 提供扩展方法

Fast.NET.Core.IConfigurationExtension.Reload

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IConfiguration Reload(this IConfiguration configuration)

刷新配置对象

  • 参数 configuration:用于读取模块设置的配置
  • 返回:刷新配置对象

Fast.NET.Core.WebApplicationBuilderExtension

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class WebApplicationBuilderExtension

WebApplicationBuilder 提供扩展方法

Fast.NET.Core.WebApplicationBuilderExtension.Initialize

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static WebApplicationBuilder Initialize(this WebApplicationBuilder builder)

框架初始化

  • 参数 builder:要配置的应用构建器
  • 返回:返回 builder,便于链式调用

Fast.NET.Core.CorsAccessorSettingsOptions

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public sealed class CorsAccessorSettingsOptions : IPostConfigure

跨域配置选项

Fast.NET.Core.CorsAccessorSettingsOptions.PolicyName

源码 · 目标:net8.0、net9.0、net10.0

csharp
[Required]
    public string PolicyName { get; set; }

策略名称

Fast.NET.Core.CorsAccessorSettingsOptions.WithOrigins

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string[] WithOrigins { get; set; }

允许来源域名,没有配置则允许所有来源

Fast.NET.Core.CorsAccessorSettingsOptions.WithHeaders

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string[] WithHeaders { get; set; }

请求表头,没有配置则允许所有表头

Fast.NET.Core.CorsAccessorSettingsOptions.WithExposedHeaders

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string[] WithExposedHeaders { get; set; }

设置客户端可获取的响应标头

Fast.NET.Core.CorsAccessorSettingsOptions.WithMethods

源码 · 目标:net8.0、net9.0、net10.0

csharp
public string[] WithMethods { get; set; }

设置跨域允许请求谓词,没有配置则允许所有

Fast.NET.Core.CorsAccessorSettingsOptions.AllowCredentials

源码 · 目标:net8.0、net9.0、net10.0

csharp
public bool? AllowCredentials { get; set; }

是否允许跨域请求中的凭据

Fast.NET.Core.CorsAccessorSettingsOptions.SetPreflightMaxAge

源码 · 目标:net8.0、net9.0、net10.0

csharp
public int? SetPreflightMaxAge { get; set; }

设置预检过期时间

Fast.NET.Core.CorsAccessorSettingsOptions.FixedClientToken

源码 · 目标:net8.0、net9.0、net10.0

csharp
public bool? FixedClientToken { get; set; }

修正前端无法获取 Token 问题

Fast.NET.Core.CorsAccessorSettingsOptions.SignalRSupport

源码 · 目标:net8.0、net9.0、net10.0

csharp
public bool? SignalRSupport { get; set; }

启用 SignalR 跨域支持

Fast.NET.Core.CorsAccessorSettingsOptions.PostConfigure

源码 · 目标:net8.0、net9.0、net10.0

csharp
public void PostConfigure()

说明继承自接口或基类,需结合对应声明阅读。

Fast.NET.Core.AssemblyUtil

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class AssemblyUtil

Assembly 工具类

Fast.NET.Core.AssemblyUtil.GetAssembly

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Assembly GetAssembly(string assemblyName)

根据程序集名称获取运行时程序集

  • 参数 assemblyName:目标程序集名称
  • 返回:根据程序集名称获取运行时程序集

Fast.NET.Core.AssemblyUtil.LoadAssembly

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Assembly LoadAssembly(string path)

根据路径加载程序集

  • 参数 path:绝对路径
  • 返回:根据路径加载程序集

Fast.NET.Core.AssemblyUtil.LoadAssembly

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Assembly LoadAssembly(MemoryStream assembly)

通过流加载程序集

  • 参数 assembly:MemoryStream 内存流
  • 返回:通过流加载程序集

Fast.NET.Core.AssemblyUtil.GetType

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Type GetType(string assemblyName, string typeFullName)

根据程序集名称、类型完整限定名获取运行时类型

  • 参数 assemblyName:目标程序集名称
  • 参数 typeFullName:目标类型的完全限定名
  • 返回:根据程序集名称、类型完整限定名获取运行时类型

Fast.NET.Core.AssemblyUtil.GetType

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Type GetType(MemoryStream assembly, string typeFullName)

根据程序集和类型完全限定名获取运行时类型

  • 参数 assembly:MemoryStream 内存流
  • 参数 typeFullName:目标类型的完全限定名
  • 返回:根据程序集和类型完全限定名获取运行时类型

Fast.NET.Core.JsonUtils

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class JsonUtils

JSON 工具类

Fast.NET.Core.JsonUtils.ReadJsonFile

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IDictionary<string, string> ReadJsonFile(string path)

读取 JSON 文件

  • 参数 path:目标路径
  • 返回:读取到的 JSON 文件

Fast.NET.Core.JsonUtils.ParseJson

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static IDictionary<string, string> ParseJson(string json)

解析 JSON 字符串

  • 参数 json:要解析的 JSON 文本
  • 返回:解析后的 JSON 字符串

Fast.NET.Core.MachineUtil

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class MachineUtil

系统机器工具类

Fast.NET.Core.MachineUtil.IsUnix

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static bool IsUnix()

是否为 Unix/Linux 操作系统

  • 返回:满足条件时返回 true;否则返回 false

Fast.NET.Core.MachineUtil.IsMacOS

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static bool IsMacOS()

是否为 MacOS 操作系统

  • 返回:满足条件时返回 true;否则返回 false

Fast.NET.Core.MachineUtil.GetOSDescription

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static string GetOSDescription()

获取当前操作系统的版本描述

  • 返回:macOS 或 Linux 的发行版本;Windows 返回运行时提供的操作系统描述

Fast.NET.Core.MachineUtil.GetSystemStartTime

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static DateTime GetSystemStartTime()

获取系统启动时间

  • 返回:获取到的系统启动时间

Fast.NET.Core.MachineUtil.GetSystemRunTimes

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static string GetSystemRunTimes(string format = "dd\\ \\\\ hh\\ \\\\ mm\\ \\\\ ss\\ \\秒")

获取系统运行时间描述

  • 参数 format:输出格式化,默认:“00 天 00 时 00 分 00 秒”
  • 返回:获取到的系统运行时间描述

Fast.NET.Core.MachineUtil.GetProgramStartTime

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static DateTime GetProgramStartTime()

获取当前进程启动时间

  • 返回:获取到的当前进程启动时间

Fast.NET.Core.MachineUtil.GetProgramRunTimes

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static string GetProgramRunTimes(string format = "dd\\ \\\\ hh\\ \\\\ mm\\ \\\\ ss\\ \\秒")

获取当前进程运行时间描述

  • 参数 format:输出格式化,默认:“00 天 00 时 00 分 00 秒”
  • 返回:获取到的当前进程运行时间描述

Fast.NET.Core.MachineUtil.GetSystemCpuRate

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static List<decimal> GetSystemCpuRate()

获取操作系统 CPU 使用率

  • 返回:获取到的操作系统 CPU 使用率集合

Fast.NET.Core.MachineUtil.GetProgramCpuUsage

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static async Task<decimal> GetProgramCpuUsage(int sleep = 500)

在指定采样间隔内计算当前进程的 CPU 使用率

  • 参数 sleep:采样间隔,单位为毫秒;默认值为 500
  • 返回:表示异步采样的任务,任务结果为按逻辑处理器数量归一化后的 CPU 使用百分比

Fast.NET.Core.MachineUtil.GetSystemRamInfo

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (decimal total, decimal used, decimal free) GetSystemRamInfo()

获取操作系统内存信息,单位(MB)

  • 返回:total:总内存 used:已用内存 free:可用内存

Fast.NET.Core.MachineUtil.GetProgramMemoryInfo

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (decimal working, decimal peakWorking, decimal virtualMemory, decimal peakVirtualMemory, decimal pagedMemory,
        decimal peakPagedMemory) GetProgramMemoryInfo()

获取当前进程内存信息,单位(MB)

  • 返回:working:RAM 物理内存 peakWorking:最大 RAM 物理内存 virtualMemory:虚拟内存 peakVirtualMemory:最大虚拟内存 pagedMemory:分页内存 peakPagedMemory:最大分页内存

Fast.NET.Core.MachineUtil.GetDiskInfos

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static List<DiskInfo> GetDiskInfos()

获取硬盘信息

  • 返回:获取到的硬盘信息集合

Fast.NET.Core.RemoteRequestUtil

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class RemoteRequestUtil

HttpClient 远程请求工具类

Fast.NET.Core.RemoteRequestUtil.GetDaySentence

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static async Task<DaySentenceInfo> GetDaySentence()

得到每日一句

  • 返回:表示异步得到每日一句的任务,任务结果为得到每日一句

Fast.NET.Core.RemoteRequestUtil.Get

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (T result, HttpResponseHeaders headers) Get<T>(string url, object param = null,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

发送 HTTP GET 请求

  • 参数 url:请求的 URL
  • 参数 param:请求参数对象
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:HTTP Get 请求

Fast.NET.Core.RemoteRequestUtil.GetAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(T result, HttpResponseHeaders headers)> GetAsync<T>(string url, object param = null,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

异步发送 HTTP GET 请求

  • 参数 url:请求的 URL
  • 参数 param:请求参数对象
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:表示异步 HTTP Get 请求的任务,任务结果为 HTTP Get 请求

Fast.NET.Core.RemoteRequestUtil.Get

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (string result, HttpResponseHeaders headers) Get(string url, object param = null,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

发送 HTTP GET 请求

  • 参数 url:请求的 URL
  • 参数 param:请求参数对象
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:HTTP Get 请求

Fast.NET.Core.RemoteRequestUtil.GetAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(string result, HttpResponseHeaders headers)> GetAsync(string url, object param = null,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

异步发送 HTTP GET 请求

  • 参数 url:请求的 URL
  • 参数 param:请求参数对象
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:表示异步 HTTP Get 请求的任务,任务结果为 HTTP Get 请求

Fast.NET.Core.RemoteRequestUtil.Post

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (T result, HttpResponseHeaders headers) Post<T>(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

发送 HTTP POST 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:HTTP Post 请求

Fast.NET.Core.RemoteRequestUtil.PostAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(T result, HttpResponseHeaders headers)> PostAsync<T>(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

异步发送 HTTP POST 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:表示异步 HTTP Post 请求的任务,任务结果为 HTTP Post 请求

Fast.NET.Core.RemoteRequestUtil.Post

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (string result, HttpResponseHeaders headers) Post(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

发送 HTTP POST 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:HTTP Post 请求

Fast.NET.Core.RemoteRequestUtil.PostAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(string result, HttpResponseHeaders headers)> PostAsync(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

异步发送 HTTP POST 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:表示异步 HTTP Post 请求的任务,任务结果为 HTTP Post 请求

Fast.NET.Core.RemoteRequestUtil.Put

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (T result, HttpResponseHeaders headers) Put<T>(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

发送 HTTP PUT 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:HTTP Put 请求

Fast.NET.Core.RemoteRequestUtil.PutAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(T result, HttpResponseHeaders headers)> PutAsync<T>(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

异步发送 HTTP PUT 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:表示异步 HTTP Put 请求的任务,任务结果为 HTTP Put 请求

Fast.NET.Core.RemoteRequestUtil.Put

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (string result, HttpResponseHeaders headers) Put(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

发送 HTTP PUT 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:HTTP Put 请求

Fast.NET.Core.RemoteRequestUtil.PutAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(string result, HttpResponseHeaders headers)> PutAsync(string url, object data,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

异步发送 HTTP PUT 请求

  • 参数 url:请求的 URL
  • 参数 data:要处理或传输的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:表示异步 HTTP Put 请求的任务,任务结果为 HTTP Put 请求

Fast.NET.Core.RemoteRequestUtil.Delete

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (T result, HttpResponseHeaders headers) Delete<T>(string url, IDictionary<string, string> headers = null,
        bool paramEncode = false, int? timeout = 60) where T : class

发送 HTTP DELETE 请求

  • 参数 url:请求的 URL
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:HTTP Delete 请求

Fast.NET.Core.RemoteRequestUtil.DeleteAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(T result, HttpResponseHeaders headers)> DeleteAsync<T>(string url,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60) where T : class

异步发送 HTTP DELETE 请求

  • 参数 url:请求的 URL
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:表示异步 HTTP Delete 请求的任务,任务结果为 HTTP Delete 请求

Fast.NET.Core.RemoteRequestUtil.Delete

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static (string result, HttpResponseHeaders headers) Delete(string url, IDictionary<string, string> headers = null,
        bool paramEncode = false, int? timeout = 60)

发送 HTTP DELETE 请求

  • 参数 url:请求的 URL
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:HTTP Delete 请求

Fast.NET.Core.RemoteRequestUtil.DeleteAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static Task<(string result, HttpResponseHeaders headers)> DeleteAsync(string url,
        IDictionary<string, string> headers = null, bool paramEncode = false, int? timeout = 60)

异步发送 HTTP DELETE 请求

  • 参数 url:请求的 URL
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:请求参数使用的文本编码
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:表示异步 HTTP Delete 请求的任务,任务结果为 HTTP Delete 请求

Fast.NET.Core.RemoteRequestUtil.SendAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static async Task<(T result, HttpResponseHeaders headers)> SendAsync<T>(HttpMethod httpMethod, string url,
        object urlParam = null, object bodyData = null, IDictionary<string, string> headers = null, bool paramEncode = false,
        int? timeout = 60)

发送请求

  • 参数 httpMethod:HTTP 请求方法
  • 参数 url:请求的 URL
  • 参数 urlParam:要追加到请求地址的查询参数
  • 参数 bodyData:要写入请求正文的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:是否对 URL 参数进行编码,默认 false
  • 参数 timeout:请求超时时间,默认 60 秒,null 则不超时
  • 类型参数 T:响应正文反序列化后的模型类型
  • 返回:表示异步发送请求的任务,任务结果为发送请求

Fast.NET.Core.RemoteRequestUtil.SendAsync

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static async Task<(string result, HttpResponseHeaders headers)> SendAsync(HttpMethod httpMethod, string url,
        object urlParam = null, object bodyData = null, IDictionary<string, string> headers = null, bool paramEncode = false,
        int? timeout = 60)

发送请求

  • 参数 httpMethod:HTTP 请求方法
  • 参数 url:请求的 URL
  • 参数 urlParam:要追加到请求地址的查询参数
  • 参数 bodyData:要写入请求正文的数据
  • 参数 headers:随请求发送的 HTTP 标头集合
  • 参数 paramEncode:是否对 URL 参数进行编码,默认 false
  • 参数 timeout:请求超时时间,默认 60 秒,null 则不超时
  • 返回:表示异步发送请求的任务,任务结果为发送请求

Fast.NET.Core.ShellUtil

源码 · 目标:net8.0、net9.0、net10.0

csharp
[SuppressSniffer]
public static class ShellUtil

系统 Shell 工具类

Fast.NET.Core.ShellUtil.Bash

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static string Bash(string command, int timeout = 0)

Linux Bash 命令

  • 参数 command:要执行的命令文本
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:Linux Bash 命令

Fast.NET.Core.ShellUtil.Cmd

源码 · 目标:net8.0、net9.0、net10.0

csharp
public static string Cmd(string command, string args = null, int timeout = 0)

Windows Cmd 命令

  • 参数 command:要执行的命令文本
  • 参数 args:格式化消息时使用的参数
  • 参数 timeout:超时时间,单位为毫秒
  • 返回:Windows Cmd 命令