diff --git a/framework/Furion/RemoteRequest/Internal/HttpClientPartMethods.cs b/framework/Furion/RemoteRequest/Internal/HttpClientPartMethods.cs
index b74e1d5409b..e32066c422c 100644
--- a/framework/Furion/RemoteRequest/Internal/HttpClientPartMethods.cs
+++ b/framework/Furion/RemoteRequest/Internal/HttpClientPartMethods.cs
@@ -17,6 +17,11 @@ namespace Furion.RemoteRequest
///
public sealed partial class HttpClientPart
{
+ ///
+ /// MiniProfiler 分类名
+ ///
+ private const string MiniProfilerCategory = "httpclient";
+
///
/// 发送 GET 请求返回 T 对象
///
@@ -256,11 +261,11 @@ public async Task SendAsync(CancellationToken cancellationT
// 检查请求地址
if (string.IsNullOrEmpty(RequestUrl)) throw new NullReferenceException(RequestUrl);
- var finalRequestUrl = RequestUrl;
-
// 处理模板问题
ReplaceRequestUrlTemplates();
+ var finalRequestUrl = RequestUrl;
+
// 拼接查询参数
if (Queries != null && Queries.Count > 0)
{
@@ -313,12 +318,18 @@ public async Task SendAsync(CancellationToken cancellationT
u?.Invoke(httpClient);
});
+ // 打印发送请求
+ App.PrintToMiniProfiler(MiniProfilerCategory, "Sending", $"[{Method}] {finalRequestUrl}");
+
// 发送请求
var response = await httpClient.SendAsync(request, cancellationToken);
// 请求成功
if (response.IsSuccessStatusCode)
{
+ // 打印成功请求
+ App.PrintToMiniProfiler(MiniProfilerCategory, "Succeeded", $"[StatusCode: {response.StatusCode}] Succeeded");
+
// 调用成功拦截器
ResponseInterceptors.ForEach(u =>
{
@@ -331,6 +342,9 @@ public async Task SendAsync(CancellationToken cancellationT
// 读取错误消息
var errors = await response.Content.ReadAsStringAsync(cancellationToken);
+ // 打印失败请求
+ App.PrintToMiniProfiler(MiniProfilerCategory, "Failed", $"[StatusCode: {response.StatusCode}] {errors}", true);
+
// 抛出异常
if (ExceptionInterceptors == null || ExceptionInterceptors.Count == 0) throw new HttpRequestException(errors);
// 调用异常拦截器
diff --git a/samples/Furion.Web.Core/Startup.cs b/samples/Furion.Web.Core/Startup.cs
index d96b4843863..a189492f714 100644
--- a/samples/Furion.Web.Core/Startup.cs
+++ b/samples/Furion.Web.Core/Startup.cs
@@ -22,9 +22,6 @@ public void ConfigureServices(IServiceCollection services)
// 添加实时通讯
services.AddSignalR();
-
- // 添加远程请求
- services.AddRemoteRequest();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)