0
在閱讀多個論壇時(有點)同樣的問題,但沒有任何建議的答案解決我的問題,我結束了我自己的帖子。MVC5 - 保持獲取HTTP錯誤404.0 - 使用身份進行身份驗證時未發現錯誤
正如標題所說,我在使用身份驗證啓動我的應用程序(在本地主機上進行測試)時遇到問題。
我不斷收到錯誤:
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information:
Module
IIS Web Core
Notification
MapRequestHandler
Handler
StaticFile
Error Code
0x80070002
Requested URL
http://localhost:xxxx/auth/login?ReturnUrl=%2F
Physical Path
c:\users\xxxx\documents\visual studio 2015\Projects\MyProject\MyProject\auth\login
Logon Method
Anonymous
Logon User
Anonymous
Request Tracing Directory
C:\Users\xxxx\Documents\IISExpress\TraceLogFiles\MyProject
我使用的代碼如下:
在App_Start文件夾
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "ApplicationCookie",
LoginPath = new PathString("/auth/login")
});
}
}
的一個FilterConfig類還啓動類在App_Start文件夾中:
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
filters.Add(new AuthorizeAttribute());
}
}
在Global.asax
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
}
控制器的registerFilters被調用驗證(AuthController)與actionresult
登錄(和添加的視圖它)。這裏沒什麼特別的,因爲我已經收到錯誤了。
在web.config我加入的appSettings行:
<add key="owin:AppStartup" value="MyProject.App_Start.Startup"/>
我不知道我在做什麼錯,也許有些IIS配置這是錯誤的?或者它真的是提供錯誤的途徑?
這些都是我已經嘗試
- 添加
<add key="autoFormsAuthentication" value="false" />
和<add key="enableSimpleMembership" value="false"/>
到WebConfig文件的事情(從其他幾個職位拍攝)。 - 在IIS設置匿名身份驗證的應用程序池身份,而不是特定用戶的