2017-10-20 68 views
0

该应用程序运行良好数月,但昨天有我的开发计算机(秋季创造者更新)的问题,所以检查了我的笔记本电脑上的代码,并去工作。但是现在我遇到了一个问题,即应用程序不会将令牌写入缓存数据库。添加一些断点到ASP.Net MVC ADAL TokenCache忽略AfterAccess BeforeAccess

void BeforeAccessNotification(TokenCacheNotificationArgs args) 
void AfterAccessNotification(TokenCacheNotificationArgs args) 
void BeforeWriteNotification(TokenCacheNotificationArgs args) 

方法我可以看到他们从未被击中。我的代码是相同的样本代码在这里(除了线14,具有不同的名称)

https://github.com/Azure-Samples/active-directory-dotnet-webapp-groupclaims/blob/master/WebApp-GroupClaims-DotNet/Utils/TokenDbCache.cs

我Startup.Auth.cs是一样的下面(我复制并粘贴到测试)

https://github.com/Azure-Samples/active-directory-dotnet-webapp-groupclaims/blob/master/WebApp-GroupClaims-DotNet/App_Start/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和伟大的工作。

但是在非工作应用程序中,即使一切看起来都应该如此,它仍不会运行上述方法。

enter image description here

任何想法?我处于全面亏损状态。在

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”为空

+0

你可以比较工作应用程序和不工作的应用程序来确认区别吗? –

+0

@ c2h0 - 你可以在缓存的构造函数中设置一个断点吗?从你所描述的看来,它看起来像是在实体框架层面上有某些东西(即无法联系数据库?“,所以无法检索到缓存的信息? –

回答

0

感谢您的答复,这个问题变成了关键= ,忽视它,因为我认为

catch (AdalException ex) 

会抓住这一点。

相关问题