会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
流年sugar
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
35
下一页
2024年11月12日
System.Data.SqlClient is not supported on this platform.
摘要: 异常: 程序在修改了非数据库相关的代码后发布进行部分覆盖,抛出异常,本次并未覆盖数据库相关的dll 查询解决方案都给出的是,将本地的Microsoft.Data.SqlClient.dll拷贝到发布处覆盖,这种方式不行 本次原因: 之前发布是目标运行时选的“可移植”,部署地方还是保持可移植,而本次因
阅读全文
posted @ 2024-11-12 16:29 流年sugar
阅读(495)
评论(0)
推荐(0)
2024年11月7日
关于ServiceLifetime(服务生命周期)中Transient与Scoped的理解
摘要: ServiceLifetime几种注入方式的解释: Transient:每次请求服务时,都会创建一个新实例,这种生命周期适合用于轻量级服务(如Repository和ApplicationService服务)。 Scoped:为每个HTTP请求创建一个实例,生命周期将横贯整次请求。 SingleTon
阅读全文
posted @ 2024-11-07 16:38 流年sugar
阅读(144)
评论(0)
推荐(0)
2024年11月6日
sqlserver 数据库连接异常 SqlClient.SqlException (0x80090325): 证书链是由不受信任的颁发机构颁发的
摘要: 异常 解决方案: 数据库连接增加“TrustServerCertificate=True;” 完整连接 Server=.;Database=TestDb;User Id=sa;Password=aaaaa;Encrypt=True;TrustServerCertificate=True; Trust
阅读全文
posted @ 2024-11-06 15:54 流年sugar
阅读(486)
评论(0)
推荐(1)
EF Core 仓储模式
摘要: 数据库:SqlServer为例 安装包: 数据库连接 DbContext public class TestDbContext:DbContext { public TestDbContext(DbContextOptions<TestDbContext> options) : base(optio
阅读全文
posted @ 2024-11-06 15:03 流年sugar
阅读(217)
评论(0)
推荐(0)
.NET Core 泛型类的依赖注入
摘要: 接口:IRepository<T> 实现:BaseRepository<T> builder.Services.AddTransient(typeof(IRepository<>),typeof(BaseRepository<>));
阅读全文
posted @ 2024-11-06 14:25 流年sugar
阅读(58)
评论(0)
推荐(0)
2024年10月25日
关于读取context.Request.Body.Position 异常:Specified method is not supported.
摘要: 异常: 代码: 读取到的Positon是空的 解决: 在调用Positon前调用context.Request.EnableBuffering() EnableBuffering() 表示允许http请求中的body重复读取,如果不加这个方法当数据在验签过程中读取出来之后到了控制器时,控制器中获取到
阅读全文
posted @ 2024-10-25 16:06 流年sugar
阅读(72)
评论(0)
推荐(0)
2024年10月21日
ASP.NET Cookie身份认证
摘要: 1.添加Cookie身份验证方案 services.AddAuthentication(option =>{ option.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; option.De
阅读全文
posted @ 2024-10-21 17:05 流年sugar
阅读(100)
评论(0)
推荐(0)
2024年10月11日
coscmd 报错 ImportError: cannot import name 'SafeConfigParser' from 'configparser'
摘要: Windows下通过Python安装coscmd,执行coscmd命令时报错 原因:本地Python装的是3.13.0版本,这个版本不支持SafeConfigParser这个类,源代码改为使用RawConfigParser 解决:到Python的安装路径下找到cos_cmd.py文件将SafeCon
阅读全文
posted @ 2024-10-11 14:28 流年sugar
阅读(234)
评论(0)
推荐(0)
2024年10月9日
c# 收到的邮件内容乱码(中文)
摘要: 现象: 原因:Net Core以后默认缺失中文字符集 解决方法 安装包System.Text.Encoding.CodePages 程序入口Program.cs中注入字符 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); 参
阅读全文
posted @ 2024-10-09 17:01 流年sugar
阅读(50)
评论(0)
推荐(0)
2024年9月26日
Abp 使用app.UseStaticFiles配置静态文件中间件以达到创建虚拟路径
摘要: 若访问项目文件wwwroot以外的其他静态文件使用如下方式访问 1.配置文件中配置路径(appsetting) "App": { "ServerRootAddress": "https://localhost:44301/", "ClientRootAddress": "https://localh
阅读全文
posted @ 2024-09-26 14:17 流年sugar
阅读(145)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
35
下一页
公告