【问题标题】:DotNetOpenAuth "Inheritance security rules violated"DotNetOpenAuth“违反继承安全规则”
【发布时间】:2012-04-06 14:50:59
【问题描述】:

我有一个 ASP.NET MVC4 应用程序,它使用 DotNetOpenAuth 4.0.1 通过 OpenId 提供程序 (Google) 对用户进行身份验证。在我的开发机器(本地主机)上一切正常。

但是,当我将 Web 应用程序部署到服务器(共享主机)时,我在尝试进行身份验证时收到以下错误(特别是当我尝试创建 OpenIdRelyingParty 时):

覆盖成员时违反了继承安全规则:“DotNetOpenAuth.Messaging.ProtocolException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)”。重写方法的安全可访问性必须与被重写方法的安全可访问性相匹配。

堆栈跟踪:

DotNetOpenAuth.Messaging.ErrorUtilities.VerifyProtocol(Boolean condition, String message, Object[] args) +0
DotNetOpenAuth.Messaging.Channel.ValidateAndPrepareBindingElements(IEnumerable`1 elements) +524
DotNetOpenAuth.Messaging.Channel..ctor(IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements) +316
DotNetOpenAuth.OpenId.ChannelElements.OpenIdChannel..ctor(IMessageFactory messageTypeProvider, IChannelBindingElement[] bindingElements) +48
DotNetOpenAuth.OpenId.ChannelElements.OpenIdRelyingPartyChannel..ctor(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore, RelyingPartySecuritySettings securitySettings) +52
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty..ctor(ICryptoKeyStore cryptoKeyStore, INonceStore nonceStore) +570
DotNetOpenAuth.OpenId.RelyingParty.OpenIdRelyingParty..ctor() +65
MyProject.Controllers.OpenIdController.Authenticate(String returnUrl) in OpenIdController.cs:81
...

我听说 DotNetOpenAuth 在中等信任度下运行良好,所以我很惊讶地发现了一个错误。我该如何解决?需要修改 DotNetOpenAuth 源代码还是有更简单的方法?

这个问题似乎类似于this one,但我不知道源代码的哪些部分需要编辑。同样奇怪的是,之前没有人就 DotNetOpenAuth 提出过这个问题,所以也许我做错了什么?请帮忙!

【问题讨论】:

    标签: asp.net security dotnetopenauth


    【解决方案1】:

    您似乎正在运行针对 .NET 3.5 的 DotNetOpenAuth 构建。 .NET 4.0 引入的一个重大变化是对不同安全属性的要求。你可以get the DotNetOpenAuth build that targets .NET 4.0 from NuGet

    【讨论】:

    • 感谢您的回复。我肯定有 .NET 4 版本(参考文献说 Runtime Version v4.0.30319)。而且我的应用程序正在引用正确的 DLL,因为当我删除它们时,它会要求它们。知道还会发生什么吗?
    • 我会将此标记为答案,但我不确定发生了什么。最后我搬到了不同的托管服务提供商,它工作正常。
    • 我在 .net 4 上也遇到了这个问题。我也很确定我使用的是 .NET 4.0 ...
    • ...但下载 dotnetauth 3.7 似乎对我有用。在 .Net 4 上。
    猜你喜欢
    • 2021-05-16
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-29
    • 2011-03-04
    相关资源
    最近更新 更多