小编Dmi*_*try的帖子

使用Azure WebSites时,定期ServiceBus错误"X.509证书CN = servicebus.windows.net不在受信任的人员存储中"

我在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)

.net servicebus azure

14
推荐指数
1
解决办法
1562
查看次数

如何通过ViewImports访问来自helper/service的@Conjected的ViewContext

我写的辅助类,并在注射_ViewImports

@inject HtmlHelperInject.TestHelper TestHelper
Run Code Online (Sandbox Code Playgroud)

并注册在Startup.ConfigureServices

services.AddTransient<TestHelper>();
Run Code Online (Sandbox Code Playgroud)

我如何ViewContext在这个助手班中获得?我尝试通过控制器注入 - 不工作,通过[ViewContext]属性属性 - 不工作.

asp.net-mvc asp.net-core-mvc

7
推荐指数
1
解决办法
607
查看次数

ASP.NET 5 Identity 3用户在一段时间后退出

我使用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)

asp.net-identity-3 asp.net-core

2
推荐指数
1
解决办法
1058
查看次数