posted @ 2022-06-12 18:07
06 2022 档案
摘要:1.使用中间件做全局异常处理,具体代码如下: public class CustomExceptionMiddleware { private readonly RequestDelegate _next; private readonly ILogger<CustomExceptionMiddle
阅读全文
摘要:在正常开发web api时需要返回固定格式的json数据,这样前端处理也方便,具体操作如下: 1.建立自定义过滤器 public class WebApiResultFilter : ActionFilterAttribute { public override void OnResultExecu
阅读全文
posted @ 2022-06-09 09:04
摘要:在.netcore3.1项目中使用newtonsoft.json步骤 1.引用nuget包 :Microsoft.AspNetCore.Mvc.NewtonsoftJson 2.Startup.cs里的ConfigureServices方法添加以下代码 public void ConfigureSe
阅读全文
posted @ 2022-06-08 15:56
摘要:在自己的webapi项目上按照官方配置swagger后,显示如上错误,具体配置swagger方法: https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetc
阅读全文
posted @ 2022-06-07 11:01
摘要:搭建IIS后报错: 解决方法: 修改sqlserver配置: 点开安全性>登录名>找到所提示的用户名“NT AUTHORITY/SYSTEM”右键属性>服务器角色>勾选sysadmin
阅读全文
posted @ 2022-06-05 23:00
摘要:最近搭建netcore WebApi 时数据库使用集成认证时,搭建IIS后,调用接口时报 无法打开登录所请求的数据库 \"JiaShiBumperTreeDB\"。登录失败。\r\n用户 'IIS APPPOOL\\jswebapi' 登录失败。 具体解决方法: 1.修改IIS应用程序池的标识--
阅读全文
posted @ 2022-06-05 22:54