随笔分类 -  C#

C#
摘要:.Net Core NLog 配置 通过日志,记录每个接口请求的耗时情况 结合 <logger name="*" level="Trace" writeTo="tracefile"/> 配置使用,NLog 热生效不需要重启服务 WebApi Global.asax.cs protected void 阅读全文
posted @ 2021-12-28 11:57 VipSoft 阅读(421) 评论(0) 推荐(0)
摘要:工具:Visual Studio 2019 1、新建一个 .NET Standard 类库。 2、填写项目名称 3、编辑项目文件 可以看到当前类库默认为 netstandard2.0,而此时其xml标签为 TargetFramework。如果要支持多版本,则需要做调整,将 TargetFramewo 阅读全文
posted @ 2021-12-14 10:32 VipSoft 阅读(555) 评论(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 阅读(185) 评论(0) 推荐(0)
摘要:如何VS IIS Express 启动项目后,绑本机IP,让别人可以访问你的网站,方便Debug 一、修改iis配置 1、在web服务器执行后,会运行IIS Express,右击它选择显示所有应用程序: 2、左击第一个localhost,再点击下方出现的配置一栏对应的文件: 3、在打开的配置文件中往 阅读全文
posted @ 2021-05-25 15:22 VipSoft 阅读(435) 评论(0) 推荐(0)
摘要:Debug的时候碰到这个很烦人得重新运行 工具=>选项=>常规=>调试=>常规 将启用“编辑”并继续,勾取消掉 阅读全文
posted @ 2021-04-01 11:46 VipSoft 阅读(2240) 评论(0) 推荐(0)
摘要:断点续传(上传)Java版 1. 客户每次上传前先获取一下当前文件已经被服务器接受了多少 2. 上传时设定偏移量 服务端代码如下: /// <summary> /// 断点续传,获取已上传文件大小 /// </summary> /// <returns></returns> [HttpPost] p 阅读全文
posted @ 2021-02-20 09:36 VipSoft 阅读(358) 评论(0) 推荐(0)
摘要:注意: CompressionLevel 选择 阅读全文
posted @ 2021-01-25 20:11 VipSoft 阅读(191) 评论(0) 推荐(0)
摘要:解决 C# Winform 自定义窗口,最大化遮住任务栏 的问题,可以通过获取屏幕大小来控制最大值,来实现,代码如下 Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this); this.MaximumSize = 阅读全文
posted @ 2020-12-08 11:07 VipSoft 阅读(863) 评论(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 阅读(3535) 评论(2) 推荐(0)
摘要:通过 itextpdf 的 HtmlConverter.convertToPdf(); 方法生成的pdf 有点让人失望,CSS啥的不起作用了,(有可能我用得不对) 后来用 wkhtmltopdf.exe 做了 网页生成PDF 效果还可以,下面是JAVA代码,C#的差不多 public static 阅读全文
posted @ 2020-10-21 08:48 VipSoft 阅读(757) 评论(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 阅读(3974) 评论(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 阅读(5266) 评论(0) 推荐(1)
摘要:app.UseIpRateLimiting(); #需要放在前面,否则抓去不准,还有可能会出现下列错误 本次出现这个错误,是因为 .Net Core 跨域 里面的这行:httpContext.Response.StatusCode = 204; 由于StatusCode 先给它设了 204,所以导致 阅读全文
posted @ 2020-06-04 14:07 VipSoft 阅读(3239) 评论(2) 推荐(0)
摘要:1.Demo,实际项目中不这么使用 class Program { static void Main(string[] args) { //缓存的配置 MemoryCacheOptions cacheOps = new MemoryCacheOptions() { //缓存最大为100份 //##注 阅读全文
posted @ 2020-05-16 14:37 VipSoft 阅读(1558) 评论(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 阅读(2819) 评论(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 阅读(872) 评论(0) 推荐(0)
摘要:1.Nuget包添加引用: X.PagedList.Mvc.Core 2.View: @using VipSoft.Web.Model @model X.PagedList.IPagedList<VipSoft.Web.Model.DBEntity.Job> @using X.PagedList.M 阅读全文
posted @ 2020-05-14 19:56 VipSoft 阅读(1460) 评论(0) 推荐(0)
摘要:StartUp.cs public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( nam 阅读全文
posted @ 2020-05-14 13:57 VipSoft 阅读(277) 评论(0) 推荐(0)
摘要:Startup.cs public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseCorsMiddleware(); //其它代码...... } CorsMiddleware.cs using S 阅读全文
posted @ 2020-05-12 20:56 VipSoft 阅读(468) 评论(1) 推荐(0)
摘要:仅我的代码“警告 你正在调试 XXX.dll 的发布版本。如果在启用”仅我的代码”的同时使用通过编译器优化的发布版本,调试体验会降级(例如,将不会命中断点) 停止调试 禁用仅我的代码并继续 继续调试 继续调试(不再询问) 阅读全文
posted @ 2020-04-27 14:16 VipSoft 阅读(5526) 评论(0) 推荐(0)