当前位置: 首页 > news >正文

tk网站的dns修改网站开发教程H5

tk网站的dns修改,网站开发教程H5,网站logo用什么来做,汕头网站设计电话这是这两天ASP.NET Core迁移中遇到的一个问题。2个ASP.NET Core站点#xff08;对应于2个不同的ASP.NET Core Web应用程序#xff09;#xff0c;2个站点都可以登录#xff0c;但在其中任1个站点登录后#xff0c;在当前站点处于登录状态#xff0c;访问另外1个站点却处于… 这是这两天ASP.NET Core迁移中遇到的一个问题。2个ASP.NET Core站点对应于2个不同的ASP.NET Core Web应用程序2个站点都可以登录但在其中任1个站点登录后在当前站点处于登录状态访问另外1个站点却处于未登录状态。 开始以为是CookieAuthenticationOptions的设置不一致引起的检查代码后确认AuthenticationSchemeCookieNameCookieDomain都是一样的。 app.UseCookieAuthentication(new CookieAuthenticationOptions {CookieName .AspNetCore.Cookies,CookieDomain .cnblogs.com}); AuthenticationScheme的默认值是Cookies 之后怀疑是DataProtection的密钥不一致引起的我们用的是同一个阿里云redis实例存储密钥存储方式上不会造成不一致。 if (Environment.IsDevelopment()) {     services.AddDistributedMemoryCache(); } else {     services.AddDistributedServiceStackRedisCache(options     {         Configuration.GetSection(redis).Bind(options);         //Workaround for deadlock when resolving host name         IPAddress ip;         if (!IPAddress.TryParse(options.Host, out ip))         {             options.Host Dns.GetHostAddressesAsync(options.Host)             .Result.FirstOrDefault(a a.AddressFamily AddressFamily.InterNetwork).ToString();         }     }); } services.AddDataProtection().PersistKeysToDistributedStore(); 为了进一步确认密钥是否是一样的修改了 DataProtection.DistributedStore 的源代码将密钥打印在控制台运行后确认2个站点用的密钥是一样的。 public IReadOnlyCollectionXElement GetAllElements() {     var data _cache.GetString(_key);     Console.WriteLine(data);     if (!string.IsNullOrEmpty(data))     {         return XDocument.Parse(data).Root.Elements().ToList().AsReadOnly();     }     else     {         return new ListXElement().AsReadOnly();     } } 后来突然想到 services.AddDataProtection() 是不是有什么配置选项F12之后发现果然有个DataProtectionOptions public static IDataProtectionBuilder AddDataProtection(this IServiceCollection services, ActionDataProtectionOptions setupAction); 继续F12发现DataProtectionOptions只有1个属性ApplicationDiscriminator点开它的注释后问题的答案跃然而出 // // Summary: //     Provides global options for the Data Protection system. public class DataProtectionOptions {     public DataProtectionOptions();     //     // Summary:     //     An identifier that uniquely discriminates this application from all other applications     //     on the machine. The discriminator value is implicitly included in all protected     //     payloads generated by the data protection system to isolate multiple logical     //     applications that all happen to be using the same key material.     //     // Remarks:     //     If two different applications need to share protected payloads, they should ensure     //     that this property is set to the same value across both applications.     public string ApplicationDiscriminator { get; set; } } 原来不同的ASP.NET Core应用程序要使用同样的加解密方式除了共享密钥还要设置同样的ApplicationDiscriminator。 添加如下的代码后问题立马解决。 services.AddDataProtection(options options.ApplicationDiscriminator cnblogs.com); 原文地址http://www.cnblogs.com/dudu/p/6495951.html .NET社区新闻深度好文微信中搜索dotNET跨平台或扫描二维码关注
http://www.yutouwan.com/news/180232/

相关文章:

  • 网站哪家公司做的最好国外搜索关键词的网站
  • 南京网站建设推广洛可可成都设计公司
  • 企业门户网站管理制度黄冈论坛东部社区
  • 网站代理备案步骤wordpress内容分享微信
  • 湛江做网站哪家好手机软件app开发
  • 有没有哪个做美食的网站wordpress xml文件
  • 小企业网站建设方案建设网站元素搜索引擎
  • 国内外网站办公电脑租赁平台
  • 北海购物网站开发设计广州正规网站制作公司
  • 网站建设论文ppt蚌埠做网站有哪些公司
  • 南京快速建设企业网站通化市建设工程招投标网站
  • 网站制作需要网站制作第三方做网站
  • 在线网站建设平台wordpress多用户博客系统
  • 建设银行杭州招聘网站欧美网站设计
  • 石家庄网站维护棋牌软件开发定制软件
  • 现在做一个网站多少钱wordpress下载主题demo
  • 高端制作网站设计深圳罗湖商城网站建设
  • 专门做墓志铭的网站wordpress建站属于前端
  • 毕节网站开发公司电话wordpress前台多张缩略图
  • 潍坊 专业网站建设做网页网站怎么样
  • 网站怎么备案在哪里搜索引擎营销的特点
  • 建设企业网站费用硬件开发工程师是做什么的
  • 自己做的简单网站下载健康成都官微最新消息
  • 域名注册最好的网站北京seo多少钱
  • 雄县网站建设公司网站建设教程搭建芽嘱湖南岚鸿信赖
  • 网站dns解析营销型网站建设 深圳信科
  • 网站备案需要提交什么资料小程序定制开发报价
  • 网站开发人员晋升体系临沂百度seo
  • 嘉兴网站制作设计网站开发掌握哪种语言
  • 微信网站有什么作用网络营销有什么方式