该应用程序运行良好数月,但昨天有我的开发计算机(秋季创造者更新)的问题,所以检查了我的笔记本电脑上的代码,并去工作。但是现在我遇到了一个问题,即应用程序不会将令牌写入缓存数据库。添加一些断点到ASP.Net MVC ADAL TokenCache忽略AfterAccess BeforeAccess
void BeforeAccessNotification(TokenCacheNotificationArgs args)
void AfterAccessNotification(TokenCacheNotificationArgs args)
void BeforeWriteNotification(TokenCacheNotificationArgs args)
方法我可以看到他们从未被击中。我的代码是相同的样本代码在这里(除了线14,具有不同的名称)
我Startup.Auth.cs是一样的下面(我复制并粘贴到测试)
我有一个使用几乎相同的认证另一个应用程序,它工作正常,我可以看它击中了这条线在Startup.Auth
AuthenticationResult result = await
authContext.AcquireTokenByAuthorizationCodeAsync(
context.Code, new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), credential, ConfigHelper.GraphResourceId);
然后它运行BeforeAccessNotification,BeforeWriteNotification,AfterAccessNotification和伟大的工作。
但是在非工作应用程序中,即使一切看起来都应该如此,它仍不会运行上述方法。
任何想法?我处于全面亏损状态。在
AuthenticationResult result = await
authContext.AcquireTokenByAuthorizationCodeAsync(
context.Code, new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), credential, ConfigHelper.GraphResourceId);
:“GraphUrl IDA”在我的web.config移除(不知道如何),因此“ConfigHelper.GraphResourceId”为空
你可以比较工作应用程序和不工作的应用程序来确认区别吗? –
@ c2h0 - 你可以在缓存的构造函数中设置一个断点吗?从你所描述的看来,它看起来像是在实体框架层面上有某些东西(即无法联系数据库?“,所以无法检索到缓存的信息? –