首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FluentSecurity使Azure WebRole失败

FluentSecurity使Azure WebRole失败
EN

Stack Overflow用户
提问于 2013-07-17 02:33:50
回答 1查看 126关注 0票数 5

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

我有一个实现IPolicyViolationHandlerDenyAnonymousAccessPolicyViolationHandlerRequireRolePolicyViolationHandler,以及根据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一起工作,包括我的策略类?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-03 00:13:53

我们也有同样的问题;在网站上工作,但不是在Web角色中工作。

这是因为Fluent Security引用的是MVC3,而不是MVC4。在Github上对这个bug的评论更详细地介绍了https://github.com/kristofferahl/FluentSecurity/pull/39

您可以执行以下任一操作:

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

2)或者,根据上面的Github bug链接"...fix this using assembly redirect in your web.config“,如下所示

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17684377

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档