0

感谢您帮助我解决这个问题

我们在 startup.cs 以及 web.config 文件中的连接字符串上使用它,你能帮我如何停止消息我得到 Failed to ping server。服务器响应状态码 401,停止连接。无法在配置的 5000 毫秒超时内重新连接,正在断开连接。

public void ConfigureAuth(IAppBuilder app)

{
    GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(60);
    GlobalHost.Configuration.DisconnectTimeout = TimeSpan.FromSeconds(30);
    GlobalHost.Configuration.KeepAlive = TimeSpan.FromSeconds(10);
    GlobalHost.Configuration.DefaultMessageBufferSize = 500;
    app.CreatePerOwinContext(ApplicationDbContext.Create);
    app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
    app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
    app.UseCookieAuthentication(new CookieAuthenticationOptions
    {
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath = new PathString("/Main/Login"),
        CookieName = typeof(Startup).FullName,
        Provider = new CookieAuthenticationProvider
        {
            OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                validateInterval: TimeSpan.FromMinutes(30),
                regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)),
            OnApplyRedirect = ctx =>
            {
                if (!IsAjaxRequest(ctx.Request))
                {
                    ctx.Response.Redirect(ctx.RedirectUri);
                }
            }
        }
    });            
    app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
    app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
    app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
    app.MapAzureSignalR(this.GetType().FullName);
    app.Map("/DetailedErrors", map =>
    {
        HubConfiguration hubConfiguration = new HubConfiguration
        {
            EnableDetailedErrors = true,
            EnableJavaScriptProxies = false
        };
        map.MapAzureSignalR(this.GetType().FullName, hubConfiguration);
    });
}
4

0 回答 0