MVC5匿名访问失败的新页面

时间:2015-10-23 08:58:32

标签: c# .net asp.net-mvc authentication

当谈到MVC安全时,我通常使用自己的菜鸟,所以请耐心等待。

我有一个MVC5应用程序,我可以直接使用它。

当我在本地运行它时,一切正常但在我将其部署到远程网络服务器后,我遇到了身份验证问题。

项目标准附带的页面打开正常(Home,About等),但当我尝试打开我自己的一个时,我收到此错误:

  

登录失败。登录来自不受信任的域,无法使用   使用Windows身份验证。

在尝试引用模型的视图的第一行上引发错误。

我还没有在web.config中添加任何内容来允许或拒绝身份验证。

配置中的摘录如下所示:

<system.web>
  <authentication mode="None" />
  <compilation targetFramework="4.5.1" />
  <httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
  <modules>
    <remove name="FormsAuthenticationModule" />
  </modules>
  <handlers>
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <remove name="OPTIONSVerbHandler" />
    <remove name="TRACEVerbHandler" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    <add name="LessAssetHandler" path="*.less" verb="GET" type="BundleTransformer.Less.HttpHandlers.LessAssetHandler, BundleTransformer.Less" resourceType="File" preCondition="" />
  </handlers>
      <security>
          <authorization>
              <add accessType="Allow" users="?" />
          </authorization>
      </security>
</system.webServer>

如何允许访问其他页面需要做什么?

[编辑]

家庭控制器工作正常。它是标准的开箱即用的,如下所示:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ASP.NET_MVC5_Bootstrap3_3_1_LESS.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}

1 个答案:

答案 0 :(得分:0)

这是一个SQL服务器问题,而不是我认为的ASP身份验证。

连接字符串中的服务器名称是完全限定版本,例如:

  

server.domain.local

将其更改为其简短版server解决了此问题!

相关问题