随笔分类 - net core
摘要:.NET6打包部署到Windows Service 1.安装Nuget包 安装以下nuget包支持windows service 安装Microsoft.Extensions.Hosting.WindowsServices <PackageReference Include="Microsoft.A
阅读全文
摘要:虽然AutoFac中的方法都有说明,但是有些常用的方法不太好理解,不晓得这个方法的作用,是干嘛的。 1、AsImplementedInterfaces() 是以接口方式进行注入,注入这些类的所有的公共接口作为服务 2、InstancePerRequest() 每次请求共享同一个实例,使用ef时,使不
阅读全文
摘要:IDependency 依赖注入接口,表示该接口的实现类将自动注册到IoC容器中 //autofac builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); builder.Host.Configure
阅读全文
摘要:主要根据中间件来实现对.net core webapi中产生的请求和响应数据进行获取并存入日志文件中; 这里不详细介绍日志文件的使用。你可以自己接入NLog,log4net,Exceptionless等 创建接口记录的中间件 using Microliu.Core.Loggers; using Mi
阅读全文
摘要:Autofac配置 using Autofac; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web; using System.We
阅读全文
摘要:引用 Newtonsoft.Json // Post请求 public string PostResponse(string url,string postData,out string statusCode) { string result = string.Empty; //设置Http的正文
阅读全文