ClaimsPrincipal.Visual Studio 2017当前行为不同 [英] ClaimsPrincipal.Current Visual Studio 2017 different behavior

查看:91
本文介绍了ClaimsPrincipal.Visual Studio 2017当前行为不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在2017年运行VS2012 MVC 5项目.一切似乎都正常,除了 ClaimsPrincipal.Current不会返回相同的东西!

I am running a VS2012 MVC 5 project on 2017 . All seems to work fine except that ClaimsPrincipal.Current does not return the same thing!!

完全相同的代码可在VS2012开发和生产服务器上完美运行. 虽然从VS2017运行项目时ClaimsPrincipal.Current的行为有所不同.

The exact same code works perfectly on VS2012 , Development and Production server. Although when running the project from VS2017 ClaimsPrincipal.Current behaves differently.

做一些研究,我发现这篇文章 http://davidpine.net/blog/principal-architecture-changes/

Doing some research i found this article http://davidpine.net/blog/principal-architecture-changes/

声明在.NET Core ClaimsPrincipal.Current中的行为应有所不同.

Stating that in .NET Core ClaimsPrincipal.Current should behave differently .

在我的情况下,我正在两个IDE(4.0.30319.42000)中运行完全相同的.NET版本,并使用Environment.Version进行了验证.

Thing is that in my case i am running the exact same .NET version in both IDE's (4.0.30319.42000) and verified that with Environment.Version.

也可以在ClaimsPrincipal.Current上按F12键导航到完全相同的mscorlib.dll文件.

Also hitting F12 on ClaimsPrincipal.Current navigates to the exact same mscorlib.dll file.

任何帮助将不胜感激.

Any help would be appreciated.

推荐答案

发现是什么原因造成的!

Found what was causing this !

WebMatrix.Data.dll
WebMatrix.WebData.dll

bin文件夹中存在这些文件时,它们会导致此行为. 此外,它们会覆盖RazorVersion并导致开发服务器抛出不匹配的程序集引用异常.

When these files are present in the bin folder, they cause this behavior . Additionally they overwrite RazorVersion and cause the Development server to throw not matching assembly reference exceptions.

在我的项目中,我引用了 WebMatrix.WebData版本2.0.0.0

In my project i had a reference to WebMatrix.WebData Version 2.0.0.0

Visual Studio 2012由于某种原因而忽略了该引用,并且没有将WebMatrix.dll发布到bin文件夹中,因此一切正常.

Visual Studio 2012 was ignoring that reference for some reason and it wasn't publishing WebMatrix.dll to the bin folder so everything was working fine.

Visual Studio 2017将这些dll发布到bin文件夹中,并导致此冲突,该冲突可能会覆盖内置的 Simple Membership Provider 实现.

Visual Studio 2017 was publishing those dlls into the bin folder and that caused this conflict which probably was overriding the built in Simple Membership Provider implementation.

删除对 WebMatrix 的引用已解决了该问题.

Removing the reference to WebMatrix fixed the issue.

这篇关于ClaimsPrincipal.Visual Studio 2017当前行为不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆