Igo*_*man 5 c# asp.net azure azure-web-roles fluent-security
我有一个使用FluentSecurity的ASP.NET MVC网站.作为一个Azure网站,它的工作正常.我需要把它变成一个WebRole.我添加了一个WebRole项目,但WebRole在启动时失败,通用"由于发生内部服务器错误,无法显示该页面".
我有一个DenyAnonymousAccessPolicyViolationHandler和RequireRolePolicyViolationHandler实施IPolicyViolationHandler,并根据整个FluentSecurity设置http://blog.mariusschulz.com/setting-up-fluentsecurity-to-use-ninject-for-dependency-resolution.
我发现当我删除两个实现的类时,IPolicyViolationHandler然后WebRole启动就好了.我创建了一个演示此问题的示例项目,您可以在https://dl.dropboxusercontent.com/u/73642/MvcApplication1.zip找到它.
那么如何才能让FluentSecurity与Azure WebRole一起使用,包括我的策略类?
我们也遇到了同样的问题;在网站上工作,但不在 Web 角色中工作。
这是因为 Fluent Security 引用的是 MVC3,而不是 MVC4。Github 上对此错误的评论有更详细的说明https://github.com/kristofferahl/FluentSecurity/pull/39。
您可以:
1) 获取 FluentSecurity.csproj 的本地副本,并将其 System.Web.MVC 引用升级到 MVC 4,然后将其包含在您的解决方案中(这就是我们所做的)。
2) 或者,按照上面的 Github bug 链接“...使用 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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
123 次 |
| 最近记录: |