随笔分类 -  C#/.Net

摘要:这种情况一般是因为DI发现了多个构造函数导致的。可以在需要DI使用的构造函数上加上特性[ActivatorUtilitiesConstructor] [ActivatorUtilitiesConstructor] public Test(IA a) { } public Test(IB b) { } 阅读全文
posted @ 2024-09-11 11:32 三寸月光 阅读(32) 评论(0) 推荐(0) 编辑
摘要:是因为MAUI项目引用了非MAUI类库(Razor类库)导致的。虽然能生成和调试应用,但用vs发布打包时会报错。可以使用命令行打包。dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride 阅读全文
posted @ 2024-08-28 15:23 三寸月光 阅读(97) 评论(0) 推荐(0) 编辑
摘要:public async Task<string> GetString() { // 防止中间件已经读取过数据 Request.Body.Position = 0; do { ReadResult readResult = await Request.BodyReader.ReadAsync(); 阅读全文
posted @ 2024-07-11 11:02 三寸月光 阅读(116) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示