C# HTTP错误403.14-调用控制器时禁止
我已经从数据库创建了一个控制器 控制器名称为“属性” 当有人这样叫它的时候C# HTTP错误403.14-调用控制器时禁止,c#,.net,visual-studio-2015,C#,.net,Visual Studio 2015,我已经从数据库创建了一个控制器 控制器名称为“属性” 当有人这样叫它的时候 http://localhost:57496/Properties/ 它给了我这些错误 HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. Most likely causes: A default document is not configured fo
http://localhost:57496/Properties/
它给了我这些错误
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
Things you can try:
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing.
Go to the IIS Express install directory.
Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.
Detailed Error Information:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x00000000
Requested URL http://localhost:57496/Properties/
Physical Path c:\users\mohamed\documents\visual studio 2015\Projects\IdaratAlaqarat1438\IdaratAlaqarat1438\Properties\
Logon Method Anonymous
Logon User Anonymous
Request Tracing Directory C:\Users\Mohamed\Documents\IISExpress\TraceLogFiles\IDARATALAQARAT1438
More Information:
This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
View more information »
但是当我这样称呼它的时候
它起作用了
更新
我的路线图
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace IdaratAlaqarat1438
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
需要显示路由配置以查看哪个操作方法直接显示您的RouteConfig.csi已更新我的问题,因为您已经有一个名为“properties”的物理目录。看见