2017-02-16 64 views
1

時禁止我從數據庫中創建一個控制器HTTP錯誤403.14 - 呼叫控制器

控制器名稱是屬性

當呼叫它像

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/[email protected] 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

它的工作

UPDATE

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

需要顯示您的路由配置以查看哪些操作方法http:// localhost:57496/Properties/is direct to –

+0

show out your RouteConfig.cs –

+0

我已更新我的問題 – deraah

回答

-1

你可以改變你RouteConfig.cs爲:

`

  routes.MapRoute(
      name: "Default", 
      url: "{controller}/{action}/{id}", 
      defaults: new { controller = "Properties", action = "Index", id   = UrlParameter.Optional } 
     ); 
    `