授权()功能在发布时不在/帐户/注册

时间:2015-04-21 09:28:08

标签: asp.net asp.net-mvc azure controller

我确实想在我的[Authorize()] AccountController函数上使用Register函数。我根本不希望任何人在我的网站上注册新帐户。

        //[AllowAnonymous]
        [Authorize(Roles="Admin")]
        public ActionResult Register()
        {
            return View();
        }

这在localhost上进行测试时效果很好,但在Azure托管的网站上失败了。 代码在localhost上与已发布完全相同。

这里有什么问题?我猜测代码并没有正常运行。

结果Localhosthttp://i.imgur.com/aqFPlHZ.png(正确)

结果Azurehttp://i.imgur.com/gjc9Dz2.png(错误(无自动化))

编辑: 也许web.config文件中的这一行正在搞乱它?

 <system.web>
        <authentication mode="None" />
      </system.web>
      <system.webServer>
        <modules>
          <remove name="FormsAuthenticationModule" />
        </modules>
      </system.webServer>

0 个答案:

没有答案