HTTP错误403.14 - 调用控制器时禁止

时间:2017-02-16 06:39:54

标签: c# .net visual-studio-2015

我已经从数据库创建了一个控制器

控制器名称为Properties

当打电话时

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 »

但是当我这样称呼它时     http://localhost:57496/Properties/index

工作

更新

MY RouteConfig.cs

    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 }
            );
        }
    }
}

0 个答案:

没有答案