我确实想在我的[Authorize()]
AccountController
函数上使用Register
函数。我根本不希望任何人在我的网站上注册新帐户。
//[AllowAnonymous]
[Authorize(Roles="Admin")]
public ActionResult Register()
{
return View();
}
这在localhost
上进行测试时效果很好,但在Azure托管的网站上失败了。
代码在localhost
上与已发布完全相同。
这里有什么问题?我猜测代码并没有正常运行。
结果Localhost
:http://i.imgur.com/aqFPlHZ.png(正确)
结果Azure
:http://i.imgur.com/gjc9Dz2.png(错误(无自动化))
编辑: 也许web.config文件中的这一行正在搞乱它?
<system.web>
<authentication mode="None" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>