我在Azure中运行了几个网站,在一个区域内集中使用ServiceBus(也在Azure中托管).
有时(每2-3天一次)我在所有网站上同时出现相同的错误(在阅读/等待消息期间):
Microsoft.ServiceBus.Messaging.MessagingCommunicationException:
The X.509 certificate CN=servicebus.windows.net is not in the trusted people store.
The X.509 certificate CN=servicebus.windows.net chain building failed.
The certificate that was used has a trust chain that cannot be verified.
Replace the certificate or change the certificateValidationMode.
A certificate chain could not be built to a trusted root authority.
Run Code Online (Sandbox Code Playgroud)
完整的堆栈跟踪:
Microsoft.ServiceBus.Messaging.MessagingCommunicationException: The X.509 certificate CN=servicebus.windows.net is not in the trusted people store. The X.509 certificate CN=servicebus.windows.net chain building failed. The certificate that was used has a …
Run Code Online (Sandbox Code Playgroud) 我写的辅助类,并在注射_ViewImports
用
@inject HtmlHelperInject.TestHelper TestHelper
Run Code Online (Sandbox Code Playgroud)
并注册在Startup.ConfigureServices
与
services.AddTransient<TestHelper>();
Run Code Online (Sandbox Code Playgroud)
我如何ViewContext
在这个助手班中获得?我尝试通过控制器注入 - 不工作,通过[ViewContext]
属性属性 - 不工作.
我使用RC1位和外部(Google)身份验证,没有Identity.EntityFramework.
在登录期间,我设置了"记住我"标志.
登录用户幸存浏览器重启(我看到cookie设置为14天后过期)和网站重启.
但是经过一段时间不活动(大约15分钟)后,无论浏览器/站点是否重启,刷新页面都会导致退出,日志说:
info: Microsoft.AspNet.Authentication.Cookies.CookieAuthenticationMiddleware:
AuthenticationScheme: Microsoft.AspNet.Identity.Application signed out.
AuthenticationScheme: Microsoft.AspNet.Identity.External signed out.
AuthenticationScheme: Microsoft.AspNet.Identity.TwoFactorUserId signed out.
Run Code Online (Sandbox Code Playgroud)
这看起来像以前的ASP中的"会话",但我不在这里使用任何会话.
这是我的本地开发者机器,没有IIS,直接将Kestrel连接到5000端口,所以这不是数据保护问题
为什么用户被迫退出?
更新:我的Startup.cs
文件:
public void ConfigureServices(IServiceCollection services)
{
....
var identityBuilder = services
.AddIdentity<User, UserRole>(options =>
{
options.User.AllowedUserNameCharacters = null;
options.Cookies.ApplicationCookie.LoginPath = "/user/login";
options.Cookies.ApplicationCookie.LogoutPath = "/user/logout";
});
identityBuilder.Services
.AddScoped<IUserStore<User>, SportCmsDb>(serviceProvider => serviceProvider.GetService<SportCmsDb>())
.AddScoped<IRoleStore<UserRole>, SportCmsDb>(serviceProvider => serviceProvider.GetService<SportCmsDb>());
identityBuilder
.AddDefaultTokenProviders();
....
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
....
app.UseIdentity();
app.UseGoogleAuthentication(options =>
{
options.ClientId = Configuration["OAuth:Google:ClientId"];
options.ClientSecret …
Run Code Online (Sandbox Code Playgroud)