草庐IT

user_grouping

全部标签

c# - User.Identity.GetUserId() 登录成功后返回null

我定义了一个临时变量来获取当前用户ID,它总是返回null。这是截图:为什么?更新:////POST:/Account/Login[HttpPost][AllowAnonymous]publicasyncTaskLogin(LoginViewModelmodel,stringreturnUrl){if(!ModelState.IsValid){returnJson(new{success=false,ex="Failtologin."});}varresult=awaitSignInManager.PasswordSignInAsync(model.Email,model.Passwo

c# - 使用 Group By Linq 进行计数

我有一个看起来像这样的对象:Notice{stringName,stringAddress}在List中我想输出所有不同的名称以及特定名称在集合中出现的次数。例如:Notice1.Name="Travel"Notice2.Name="Travel"Notice3.Name="PTO"Notice4.Name="Direct"我要输出Travel-2PTO-1Direct-1我可以使用这段代码很好地获得不同的名称,但我似乎无法在1个linq语句中获得所有计数theNoticeNames=theData.Notices.Select(c=>c.ApplicationName).Distin

c# - 使用 Group By Linq 进行计数

我有一个看起来像这样的对象:Notice{stringName,stringAddress}在List中我想输出所有不同的名称以及特定名称在集合中出现的次数。例如:Notice1.Name="Travel"Notice2.Name="Travel"Notice3.Name="PTO"Notice4.Name="Direct"我要输出Travel-2PTO-1Direct-1我可以使用这段代码很好地获得不同的名称,但我似乎无法在1个linq语句中获得所有计数theNoticeNames=theData.Notices.Select(c=>c.ApplicationName).Distin

c# - 将 HttpContext.Current.User 与异步等待一起使用的正确方法

我正在使用异步操作并像这样使用HttpContext.Current.UserpublicclassUserService:IUserService{publicILocPrincipalCurrent{get{returnHttpContext.Current.UserasILocPrincipal;}}}publicclassChannelService:IDisposable{//IntheservicelayerpublicChannelService():this(newEntities.LocDbContext(),newUserService()){}publicChan

c# - 将 HttpContext.Current.User 与异步等待一起使用的正确方法

我正在使用异步操作并像这样使用HttpContext.Current.UserpublicclassUserService:IUserService{publicILocPrincipalCurrent{get{returnHttpContext.Current.UserasILocPrincipal;}}}publicclassChannelService:IDisposable{//IntheservicelayerpublicChannelService():this(newEntities.LocDbContext(),newUserService()){}publicChan

《项目实战》构建SpringCloud alibaba项目(三、构建服务方子工程store-user-service)

系列文章目录构建SpringCloudalibaba项目(一、构建父工程、公共库、网关)构建SpringCloudalibaba项目(二、构建微服务鉴权子工程store-authority-service)构建SpringCloudalibaba项目(三、构建服务方子工程store-user-service)文章目录系列文章目录前言1、微服务子工程store-user-service1.1、创建子工程store-user-service1.2、修改pom.xml配置1.3、修改application.yml配置1.4、配置plus分页1.4.1、添加依赖1.4.2、添加配置1.5、配置naco

c# - ASP.NET Core 2.0 JWT 验证失败,出现 `Authorization failed for user: (null)` 错误

我使用ASP.NETCore2.0应用程序(WebAPI)作为JWT颁发者来生成移动应用程序可使用的token。不幸的是,此token无法由一个Controller验证,但可以由另一个Controller验证(在同一asp.netcore2.0应用程序中使用相同的验证设置)。所以我有一个有效且可以解码的token,具有所有必需的声明和时间戳。但是一个端点接受它,而另一个端点给我401错误和调试输出:Microsoft.AspNetCore.Authorization.DefaultAuthorizationService:Information:Authorizationfailedf

c# - ASP.NET Core 2.0 JWT 验证失败,出现 `Authorization failed for user: (null)` 错误

我使用ASP.NETCore2.0应用程序(WebAPI)作为JWT颁发者来生成移动应用程序可使用的token。不幸的是,此token无法由一个Controller验证,但可以由另一个Controller验证(在同一asp.netcore2.0应用程序中使用相同的验证设置)。所以我有一个有效且可以解码的token,具有所有必需的声明和时间戳。但是一个端点接受它,而另一个端点给我401错误和调试输出:Microsoft.AspNetCore.Authorization.DefaultAuthorizationService:Information:Authorizationfailedf

连接nacos异常[NA] failed to update serviceName: UAT_GROUP@@**-** NacosException: Request Exception

nacos异常[NA]failedtoupdateserviceName:UAT_GROUP@@****-***com.alibaba.nacos.api.exception.NacosException:Requestnacosserverfailed:子服务异常信息:nacos服务异常信息:出现问题的原因:解决方案:配置housekeeper配置housekeeper执行时间间隔:除了以上两个配置项外,还可以通过其他配置项来调整housekeeper的行为,例如:nacos.cmdb.dumpTaskTimeInterval配置nacos.core.task.check.maxDelta配

c# - 无法从 'method group' 转换为 'System.Action<object>' 错误

我创建了以下函数:publicvoidDelegatedCall(ActiondelegatedMethod)并定义了如下方法publicvoidfoo1(Stringstr){}但是,当我尝试调用DelegateCall时与foo1:DelegatedCall(foo1);...我收到以下编译器错误:Argument1:cannotconvertfrom'methodgroup'to'System.Action'此错误的原因是什么,我该如何更正它?不幸的是,类型转换foo1至Action不是一个选项。 最佳答案 Delegated