【问题标题】:FluentSecurity makes Azure WebRole to failFluent Security 使 Azure Web 角色失败
【发布时间】:2013-07-16 18:33:49
【问题描述】:

我有一个使用 FluentSecurity 的 ASP.NET MVC 网站。作为 Azure 网站,它运行良好。我需要将其设为 WebRole。我添加了一个 WebRole 项目,但 WebRole 在启动时失败,并出现一个通用的“页面无法显示,因为发生了内部服务器错误。”

我有一个 DenyAnonymousAccessPolicyViolationHandlerRequireRolePolicyViolationHandler 实现 IPolicyViolationHandler 和根据 http://blog.mariusschulz.com/setting-up-fluentsecurity-to-use-ninject-for-dependency-resolution 的整个 FluentSecurity 设置。

我发现当我删除两个实现IPolicyViolationHandler 的类时,WebRole 就可以正常启动了。我创建了一个演示此问题的示例项目,您可以在 https://dl.dropboxusercontent.com/u/73642/MvcApplication1.zip 找到它。

那么如何让 FluentSecurity 与 Azure WebRole 一起使用,包括我的策略类?

【问题讨论】:

  • 您找到解决方案了吗?我的 DenyAnonymousAccessPolicyViolationHandler 遇到了完全相同的问题。
  • 我没有。我在 Github 上报告了这个错误,但我没有得到任何回应

标签: c# asp.net azure azure-web-roles fluent-security


【解决方案1】:

我们遇到了同样的问题;在网站上工作,但不是网络角色。

这是因为 Fluent Security 引用的是 MVC3,而不是 MVC4。 Github 上这个 bug 的 cmets 更详细https://github.com/kristofferahl/FluentSecurity/pull/39

您可以:

1) 获取 FluentSecurity.csproj 的本地副本并将其 System.Web.MVC 引用升级到 MVC 4,然后将其包含在您的解决方案中(这就是我们所做的)。

2) 或者,根据上面的 Github 错误链接“...在您的 web.config 中使用程序集重定向修复此问题”,如下所示

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
</runtime>

【讨论】:

    猜你喜欢
    • 2014-09-29
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多