You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
|
using System.Net.Http.Headers;
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using HttpClientStudy.Model;
|
|
|
|
|
using HttpClientStudy.WebApp.Models;
|
|
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
|
|
|
|
|
|
namespace HttpClientStudy.WebApp.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误和异常处理 控制器
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class ErrorDemoController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ErrorDemoController() { }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 500错误
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
//[AllowAnonymous]
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult Error500()
|
|
|
|
|
{
|
|
|
|
|
throw new System.Exception("服务器异常");
|
|
|
|
|
|
|
|
|
|
var result = BaseResultUtil.Success("服务器异常");
|
|
|
|
|
return new JsonResult(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|