DotNetOpenAuth“违反了继承安全规则”

时间:2012-04-06 14:51:00

标签: asp.net security dotnetopenauth

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

但是,当我将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之前没有人问过这个问题似乎很奇怪,所以也许我做错了什么?请帮忙!

1 个答案:

答案 0 :(得分:0)

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

相关问题