.net core
chchch521761
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LocalHost 请求API 返回502 Bad Gateway
HTTP Error 502.3 - Bad Gateway可能是请求超时的原因,在webconfig中把超时时间加长。原创 2023-10-17 18:16:27 · 630 阅读 · 0 评论 -
邮箱服务 POP3 / IMAP / SMTP
邮箱服务说明原创 2022-06-17 16:04:42 · 1108 阅读 · 0 评论 -
EF Core 查询导航属性
EF Core查询导航属性原创 2022-06-06 03:58:45 · 807 阅读 · 0 评论 -
EF Core DateTime 时间类型 查找 问题
EFCore DateTime 时间类型查询问题原创 2022-06-03 20:49:46 · 1433 阅读 · 0 评论 -
axios发送请求获取reponse header中的数据问题
如果是自定义的header名称,须要在跨域中设置:.WithExposedHeaders(“X-Total-Count”) services.AddCors(options => { options.AddPolicy("AllowAllOrigin", builder => { builder .AllowAnyOrigin()原创 2022-05-26 16:02:20 · 634 阅读 · 0 评论 -
EF Core 保存导航属性报错 insert_Identify 验证问题 The instance of entity type ‘name‘ cannot be tracked
原因是同一个entity存在被多个context标记为add在导航属性中,如果最顶层设置entityEntry的status为add, 那么导航熟悉会默认为add(没有主键的情况下),因此后面如果再次单独对此entity再次设置add的话,就可能出现insert_Identify 验证问题。总的来说,导航属性,只须要对顶层的entityEntry设置add状态,其他的无须在设置一遍...原创 2022-05-21 03:09:27 · 824 阅读 · 0 评论 -
EF Core 保存操作 saveChange
更新数据原理:数据库中有主键所对应的记录,修改实体到 Modified 状态,调⽤ SaveChanges 时,⽣成 Update 语句。一、更新已跟踪实体的数据当实体由 DbContext 获取,且默认为已为跟踪状态,当我们改变实体的属性值时,跟踪器将⾃动将实体的状态修改为 Modified 状态。var blog = context.Blogs.First(); blog.Url = "www.xcode.me"; context.SaveChanges();二、更新未跟踪实体的数据原创 2022-05-16 18:42:55 · 2063 阅读 · 0 评论 -
AsNoTracking 不能查询多级导航(导航的导航)实体问题,另附加 Expression Helper
当设置.AsNoTracking()时,后续实体不会再更新,所以如果实体类中的导航实体中还包含实体,则无法附加到其中。另外附加Expression Helper帮助类using System;using System.Collections.Generic;using System.Linq.Expressions;using System.Reflection;using System.Linq;using System.Text;using TemplateNetCore.Framwor原创 2022-05-16 06:04:22 · 399 阅读 · 0 评论 -
netcore consul 安装
docker pull consul # 默认拉取latestdocker run -d -p 8500:8500 --restart=always --name=consul consul:latest agent -server -bootstrap -ui -node=1 -client='0.0.0.0'agent: 表示启动 Agent 进程。server:表示启动 Consul Server 模式client:表示启动 Consul Cilent 模式。bootstrap:表示这个原创 2022-02-17 18:29:51 · 133 阅读 · 0 评论 -
netcore 启用EnableRewind倒带解决只能读取一次body的问题
netcore原创 2022-01-27 16:57:02 · 884 阅读 · 0 评论 -
Linux docker build container error -v 映射目录踩坑
正确写法:docker run -d -p 7777:80 --name=aspnetCoreDockerdemo --restart=always -v /app/wwwroot/UploadFiles/:/app/wwwroot/UploadFiles/ aspnetcoredockerdemo错误写法:docker run -d -p 7777:80 --name=aspnetCoreDockerdemo --restart=always aspnetcoredockerdemo -v /ap原创 2022-01-21 11:17:27 · 844 阅读 · 0 评论 -
linux docker 安装 portainer
linux执行命令:1、docker volume create portainer_data2、docker run -d -p 8000:8000 -p 9443:9443 --name portainer –restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.11.03、访问地址:https://localhost:944原创 2022-01-20 16:51:41 · 1286 阅读 · 0 评论 -
linux docker microsoft/dotnet:2.1-aspnetcore-runtime error (Linux生成docker netcore2.1的镜像-踩坑)
linux中docker file 引用microsoft/dotnet:2.1-aspnetcore-runtime 镜像出现错误原因如下:具体参照:https://github.com/dotnet/announcements/issues/197须要把docker file中语句:microsoft/dotnet:2.1-aspnetcore-runtime 替换为 mcr.microsoft.com/dotnet/aspnet:2.1You need to make the followi原创 2022-01-20 10:58:39 · 1026 阅读 · 0 评论 -
C# 反射 静态类 静态方法 static
C# 通过反射调用实例类或静态类的方法一、创建类//反射对象类//ruleAssembly为dell文件、ruleNmspaceName :命名空间;ruleClsName:类名Type ruleType = Assembly.Load(ruleAssembly).GetType(ruleNmspaceName + "." + ruleClsName, true, true);//反射非本程序集中的类需要先使用Assembly.Load加载//反射本程序集中的类可直接使用GetTypeGetTy原创 2021-11-25 15:38:06 · 6658 阅读 · 0 评论 -
rabbitMQ clientApi netcore
一、RabbitMQ几个对象介绍通过web管理界面截图可以看到:Connections、Channels、Exchanges、Queues、Admin1、Connections:连接RabbitMQ客户端2、Channels :通道,相当一个数据库的DB实例3、Exchanges:消息中枢,负责将发布的消息按照一定的规则放到对应队列中。4、Queues:队列,消费者从中获取消息5、Admin: 用户二、对象详细介绍1、Connections //创建连接工厂原创 2021-11-15 16:59:25 · 856 阅读 · 0 评论 -
Identity server4 静态配置 登录
一、服务端代码1、静态资源代码public class InitConfig { /// <summary> /// 定义ApiResource /// </summary> /// <returns></returns> public static IEnumerable<ApiResource> GetApiResources() {原创 2021-11-10 17:42:52 · 453 阅读 · 0 评论 -
netcore路由InvalidOperationException: Action‘‘doesnothaveanattribute route. ActionMethodsOnController
InvalidOperationException: Action ‘TemplateNetCore.Controllers.CommonController.CommonExcuteReflectionMethod (TemplateNetCore)’ does not have an attribute route. Action methods on controllers annotated with ApiControllerAttribute must be attribute routed.原创 2021-11-02 16:32:39 · 1178 阅读 · 0 评论 -
.netCore Form 上传文件 IOException: Unexpected end of Stream, the content may have already been read by
.netCore FormData 上传文件时前端报错,信息如下:IOException: Unexpected end of Stream, the content may have already been read by another component解决方案:经查原来是Controller继承了一个自定义的BaseController,去掉继承,改成继默认的ControllerBase即可...原创 2021-10-21 18:45:41 · 1789 阅读 · 0 评论 -
netcore docker for windows build image,push docker hub(linux pull镜像运行容器)
1、首先创建netcore项目2、修改属性dockerfile:始终复制3、配置dockerfileFROM microsoft/dotnet:2.1-aspnetcore-runtime AS baseWORKDIR /appCOPY ./bin/Release/netcoreapp2.1/publish /appENTRYPOINT ["dotnet", "WebApplication1.dll"]./表示当前执行powerShell所在目录,./bin/Release/netco原创 2021-07-02 00:28:33 · 435 阅读 · 0 评论
分享