随笔分类 -  C#

C#
摘要:C# CRC8 C# /// /// This enum is used to indicate what kind of checksum you will be calculating. /// public enum CRC8_POLY { CRC8 = 0xd5, CRC8_CCITT = 阅读全文
posted @ 2022-05-06 23:31 VipSoft 阅读(574) 评论(0) 推荐(0)
摘要:VS 2019 目标框架中没有 .NET Core 3.X、.Net 5.0 https://dotnet.microsoft.com/download/dotnet-core/3.0 Visual Studio 2019 (v16.3 or later) 原因: VS2019需要 v16.3 版本 阅读全文
posted @ 2022-03-22 10:31 VipSoft 阅读(1337) 评论(0) 推荐(0)
摘要:NLog.confg 参考配置, NLog 热生效不需要重启服务 <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http:// 阅读全文
posted @ 2021-12-28 12:30 VipSoft 阅读(1294) 评论(0) 推荐(0)
摘要:通过日志,记录每个接口请求的耗时情况 结合 <logger name="*" level="Trace" writeTo="tracefile"/> 配置使用,NLog 热生效不需要重启服务 增加 RequestLogMiddleware.cs public class RequestLogMidd 阅读全文
posted @ 2021-12-28 11:58 VipSoft 阅读(532) 评论(0) 推荐(0)
摘要:.Net Core NLog 配置 通过日志,记录每个接口请求的耗时情况 结合 <logger name="*" level="Trace" writeTo="tracefile"/> 配置使用,NLog 热生效不需要重启服务 WebApi Global.asax.cs protected void 阅读全文
posted @ 2021-12-28 11:57 VipSoft 阅读(435) 评论(0) 推荐(0)
摘要:工具:Visual Studio 2019 1、新建一个 .NET Standard 类库。 2、填写项目名称 3、编辑项目文件 可以看到当前类库默认为 netstandard2.0,而此时其xml标签为 TargetFramework。如果要支持多版本,则需要做调整,将 TargetFramewo 阅读全文
posted @ 2021-12-14 10:32 VipSoft 阅读(569) 评论(0) 推荐(0)
摘要:也可以用 JNA,但性能没有 JNI 好。JNA的Demo没有做,可以参考(https://www.bilibili.com/video/BV1xU4y1F7Ep/?spm_id_from=autoNext) JNI 参考(https://www.runoob.com/w3cnote/jni-get 阅读全文
posted @ 2021-12-02 14:56 VipSoft 阅读(197) 评论(0) 推荐(0)
摘要:如何VS IIS Express 启动项目后,绑本机IP,让别人可以访问你的网站,方便Debug 一、修改iis配置 1、在web服务器执行后,会运行IIS Express,右击它选择显示所有应用程序: 2、左击第一个localhost,再点击下方出现的配置一栏对应的文件: 3、在打开的配置文件中往 阅读全文
posted @ 2021-05-25 15:22 VipSoft 阅读(446) 评论(0) 推荐(0)
摘要:Debug的时候碰到这个很烦人得重新运行 工具=>选项=>常规=>调试=>常规 将启用“编辑”并继续,勾取消掉 阅读全文
posted @ 2021-04-01 11:46 VipSoft 阅读(2254) 评论(0) 推荐(0)
摘要:断点续传(上传)Java版 1. 客户每次上传前先获取一下当前文件已经被服务器接受了多少 2. 上传时设定偏移量 服务端代码如下: /// <summary> /// 断点续传,获取已上传文件大小 /// </summary> /// <returns></returns> [HttpPost] p 阅读全文
posted @ 2021-02-20 09:36 VipSoft 阅读(365) 评论(0) 推荐(0)
摘要:注意: CompressionLevel 选择 阅读全文
posted @ 2021-01-25 20:11 VipSoft 阅读(195) 评论(0) 推荐(0)
摘要:解决 C# Winform 自定义窗口,最大化遮住任务栏 的问题,可以通过获取屏幕大小来控制最大值,来实现,代码如下 Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this); this.MaximumSize = 阅读全文
posted @ 2020-12-08 11:07 VipSoft 阅读(887) 评论(1) 推荐(0)
摘要:Winform 嵌入html,数据交互,将JS中的数据等传给winform 点击浏览器中的按钮,触发 Winform 中的方法 https://github.com/cefsharp/CefSharp C# Code namespace SharpBrowser { public partial c 阅读全文
posted @ 2020-10-22 10:17 VipSoft 阅读(3567) 评论(2) 推荐(0)
摘要:通过 itextpdf 的 HtmlConverter.convertToPdf(); 方法生成的pdf 有点让人失望,CSS啥的不起作用了,(有可能我用得不对) 后来用 wkhtmltopdf.exe 做了 网页生成PDF 效果还可以,下面是JAVA代码,C#的差不多 public static 阅读全文
posted @ 2020-10-21 08:48 VipSoft 阅读(779) 评论(0) 推荐(0)
摘要:.Net Core 3.0 续:Error unprotecting the session cookie.The payload was invalid. 出现了新的BUG warn: Microsoft.AspNetCore.Session.SessionMiddleware[7] Error 阅读全文
posted @ 2020-06-05 15:14 VipSoft 阅读(4001) 评论(4) 推荐(0)
摘要:.Net Core 3.0 warn: Microsoft.AspNetCore.Session.SessionMiddleware[7] Error unprotecting the session cookie. System.Security.Cryptography.Cryptographi 阅读全文
posted @ 2020-06-04 19:25 VipSoft 阅读(5281) 评论(0) 推荐(1)
摘要:app.UseIpRateLimiting(); #需要放在前面,否则抓去不准,还有可能会出现下列错误 本次出现这个错误,是因为 .Net Core 跨域 里面的这行:httpContext.Response.StatusCode = 204; 由于StatusCode 先给它设了 204,所以导致 阅读全文
posted @ 2020-06-04 14:07 VipSoft 阅读(3248) 评论(2) 推荐(0)
摘要:1.Demo,实际项目中不这么使用 class Program { static void Main(string[] args) { //缓存的配置 MemoryCacheOptions cacheOps = new MemoryCacheOptions() { //缓存最大为100份 //##注 阅读全文
posted @ 2020-05-16 14:37 VipSoft 阅读(1564) 评论(0) 推荐(0)
摘要:Startup.cs public class Startup { public static readonly ILoggerFactory efLogger = LoggerFactory.Create(builder => { builder.AddFilter((category, leve 阅读全文
posted @ 2020-05-15 20:54 VipSoft 阅读(2822) 评论(0) 推荐(0)
摘要:using NLog; private static Logger logger = LogManager.GetCurrentClassLogger(); //初始化日志类 NLog.config <?xml version="1.0" encoding="utf-8" ?> <nlog xmln 阅读全文
posted @ 2020-05-15 11:01 VipSoft 阅读(880) 评论(0) 推荐(0)