public IActionResult A(){//B为 Action名称,Home为控制器名称 new { id = 1 }为B Action的参数return RedirectToAction("B", "Home", new { id = 1 });}public IActionResult B(int id){return View();}//转载请保留原创地址 http://www.luofenming.com/show.aspx?i…
//实体类public class User{//转载请保留 http://www.luofenming.com/show.aspx?id=ART2021021300001 public MongoDB.Bson.ObjectId Id { get; set; } public string name { get; set; } public int age { get; set; }}//using MongoDB.Bson;//using MongoDB…
不能直接在API接口里面用 System.Threading.Thread.Sleep阻塞线程,如果需要延时,要用异步处理。今天碰到这样的一个坑 在win 10 和 windows server 2008 没问题,但在windows server 2019 就出现以下问题An error occurred while processing your request.//错误的写法[Rou…
在.net core使用GB2312时抛出以下异常
System.ArgumentException:“'gb2312' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. 解决方法
在NuGet 添加“System.Text.Enco…
整个 asp.Net Core应用都是在 管道中运行的,管道中放的都是中间件。下面是自定义中间件的两种方法方法一
public class TestMiddleware
{//转载请保留 http://www.luofenming.com/show.aspx?id=ART2020021200001private readonly RequestDelegate _next;public TestMiddlewar…
Redis: REmote DIctionary Server 远程字典(内存)服务器,基于内存管理(数据全部存在内存),实现了多种数据结构的,单线程模型的应用程序,提供插入-查询-固化-集群功能。Redis特点:速度快,数据可能丢失,只能做缓存,而不是存储。以下核心代码(这里采用的是StackExchange)…