随笔分类 - .NetCore
.net8连接MySQL、连接MySQL显示SSL Authentication Error错误处理
摘要:参考.net6连接mysql:https://www.cnblogs.com/xsj1989/p/15379350.html其中.net8版本的不能安装:MySql.EntityFrameworkCore这个包,需要安装Pomelo.EntityFrameworkCore.MySql,而且版本号必须
阅读全文
VS运行网站报错Failed to register URL "http://localhost:5718/" for site
摘要:很多都说是端口被占用,的确有可能,但大部分不是这样管理员运行cmd(命令提示符),执行命令: net stop winnatnet start winnat
阅读全文
DES加密解密
摘要:来源:https://blog.csdn.net/Zhangchen9091/article/details/46278463https://blog.51cto.com/cbcw/6289416 using System; using System.IO; using System.Securit
阅读全文
.net core创建数据库、seed数据、部分修改字段、Migration
摘要:#region 创建数据库//如果数据库有表,则 EnsureCreated 方法不执行任何操作。//如果没有数据库,或者没有任何表,则它将创建数据库和架构。//EnsureCreated 启用以下工作流来处理数据模型更改://删除数据库。更改数据模型。重新运行应用。//EnsureCreated
阅读全文
.NET Core创建API项目
摘要:新建项目 类型:ASP.NET Core Web APIWeb API 控制器通常应派生自 ControllerBase 而不是 Controller。 Controller 派生自 ControllerBase,并添加对视图的支持,因此它用于处理 Web 页面,而不是 Web API 请求。 如果
阅读全文
.net core websocket
摘要:来源:https://blog.csdn.net/i2blue/article/details/125288034Program.cs #region WebSockets // https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/w
阅读全文
.net core Razor 全球化和本地化 多语言
摘要:1.根目录建文件夹:Resource(存放资源文件) 和 ResourceClass(存放对应的空白类文件)2.添加资源文件到Resource文件夹中:Language.en-US.resx 和 Language.zh-CN.resx 打开资源文件,添加配置项,例如 中文资源文件 名称:Welcom
阅读全文
读写CSV文件
摘要:来源:https://www.cnblogs.com/lxhbky/p/12219080.html using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Ref
阅读全文
VS2022/VS2019安装WinForm打包程序,Microsoft Visual Studio Installer Projects 2022下载(网盘下载),Installer Projects 2019下载,图标库,VS2022打包程序添加步骤,打包程序.Net Framework版本选择
摘要:问题:使用VS2022创建WinForm程序,完了需要打包成安装程序,这时候我去下载Microsoft Visual Studio Installer Projects 2022插件,速度超级慢,恶心人。总算是下载下来了,我存到我的网盘上面了,下载链接,速度快点:https://pan.baidu.
阅读全文
.NET CORE全局异常处理(自定义过滤器 ExceptionFilterAttribute、自定义中间件)配合log4net写日志
摘要:1、自定义中间件处理异常(推荐) 参考:https://www.csframework.com/archive/1/arc-1-20211230-4180.htm using System.Net; using System.Text.Json; using ExceptionHandling.Mo
阅读全文
RabbitMQ、ErLang下载、RabbitMQ下载
摘要:最新资源2022-07-01RabbitMQ下载链接:https://pan.baidu.com/s/1VBbH40EvY46jNRdiKYhFuw 提取码:bcuq 版本 rabbitmq-server-3.10.5.exeErLang下载链接:https://pan.baidu.com/s/14
阅读全文
Dapper用法
摘要:参考:https://www.cnblogs.com/atomy/p/12784361.htmlDapper存储过程:http://t.zoukankan.com/mengshi-p-4784640.html using Dapper; using System.Collections.Generi
阅读全文
ASP.NET Core gRPC服务基础小例子
摘要:ASP.NET Core gRPC(Google Remote Procedure Call)介绍:https://zhuanlan.zhihu.com/p/411315625参考:http://t.zoukankan.com/lhwpc-p-15157339.html文档:http://doc.o
阅读全文
.NET Core连接数据库,.Net Core连接Mysql数据库
摘要:DbContext:这里设置自定义连接字符串的写法过时了。参考连接MySql的写法。 using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using System; using WebApi.M
阅读全文
.NET Core使用JWT认证、授权
摘要:1、建.NetCore的WebApi项目,安装包IdentityModel,Microsoft.AspNetCore.Authentication.JwtBearer,Microsoft.AspNetCore.Authorization2、注册服务和中间件 using Microsoft.AspNe
阅读全文
.NET Core记录
摘要:jwt权限认证:https://www.cnblogs.com/danvic712/p/10331976.htmlhttps://blog.csdn.net/weixin_42045719/article/details/91973878http://cn.voidcc.com/question/p
阅读全文
.net core发布到iis
摘要:1、iis新建应用程序池,.NET CLR版本选择 无托管代码,托管管道模式选择 集成。2、新建网站,选择应用程序池,指定发布后文件路径。3、IIS根目录》模块》看看有没有AspNetCoreModuleV2,没有的话需要下载安装。4、.net core下载:https://dotnet.micro
阅读全文
.NET Core使用Redis
摘要:1.NuGet安装StackExchange.Redis,如果已经用了Microsoft.Extensions.Caching.Redis的话,就安装StackExchange.Redis.StrongNameStartUp.cs注入服务:services.AddSingleton<IConnect
阅读全文
.NET Core使用缓存
摘要:1.MemoryCache 服务器端缓存添加服务:services.AddMemoryCache();使用:注入IMemoryCache _memoryCache; var cityList = new List<City>(); if (!_memoryCache.TryGetValue("cit
阅读全文
.NET Core自定义TagHelper和使用Serilog写日志
摘要:代码: using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; name
阅读全文