C# 新页面的MVC5匿名访问失败
说到MVC安全性,我是个傻瓜,因为我通常使用我自己的,所以请容忍我 我有一个MVC5应用程序,我使用的几乎是开箱即用的 当我在本地运行它时,一切都很好,但是在我将它部署到远程Web服务器之后,我遇到了身份验证问题 项目附带的页面作为标准打开很好(主页、关于等),但当我尝试打开自己的页面时,会出现以下错误: 登录失败。登录名来自不受信任的域,无法使用 使用Windows身份验证 试图引用模型的视图的第一行出现错误 我没有向web.config添加任何允许或拒绝身份验证的内容 从配置中提取的内容如下所示:C# 新页面的MVC5匿名访问失败,c#,.net,asp.net-mvc,authentication,C#,.net,Asp.net Mvc,Authentication,说到MVC安全性,我是个傻瓜,因为我通常使用我自己的,所以请容忍我 我有一个MVC5应用程序,我使用的几乎是开箱即用的 当我在本地运行它时,一切都很好,但是在我将它部署到远程Web服务器之后,我遇到了身份验证问题 项目附带的页面作为标准打开很好(主页、关于等),但当我尝试打开自己的页面时,会出现以下错误: 登录失败。登录名来自不受信任的域,无法使用 使用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();
}
}
}
这是一个SQL server问题,而不是我所认为的ASP身份验证 连接字符串中的服务器名称是完全限定的版本,例如: server.domain.local
将其更改为短版本
服务器
修复了此问题 “标准”控制器上可能有全局AuthorizationFilter
和AllowAnonymous
过滤器属性?主控制器没有AllowAnonymous
过滤器,工作正常。我在整个解决方案中搜索了AuthorizationFilter
,但没有找到它。家庭控制器没有AllowAnonymous
过滤器,因此工作正常。我在整个解决方案中搜索了AuthorizationFilter
,但没有找到它。(为home controller添加了代码)