簡體   English   中英

我一直在Chrome中收到錯誤:HTTP錯誤403.14 - 禁止使用Web應用程序Visual Studio 2012

[英]I keep getting the error in Chrome: HTTP Error 403.14 - Forbidden using web application Visual Studio 2012

我有Windows 8 64位。 我正在使用Visual Studio 2012專業版。

我創建了一個新的Web應用程序項目:

新建>項目> ASP.NET空Web應用程序。

然后在項目創建之后,我右鍵單擊解決方案資源管理器:

添加> Web窗體

這是WebForm1.aspx內容:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="Scripts/jquery-ui-1.10.3.min.js"></script>
    <script src="Plugins/jquery.cookie.js"></script>
    <link href="Content/themes/Smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" />
    <script src="js/newsTicker.js"></script>
    <script src="js/mystuff.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <ul class="newsticker">
                <li>Etiam imperdiet volutpat libero eu tristique.</li>
                <li>Curabitur porttitor ante eget hendrerit adipiscing.</li>
                <li>Praesent ornare nisl lorem, ut condimentum lectus gravida ut.</li>
                <li>Nunc ultrices tortor eu massa placerat posuere.</li>
            </ul>
        </div>
    </form>
</body>
</html>

然后我創建了一個新的JavaScript文件:

在解決方案資源管理器上:

添加> JavaScript文件

文件名是mystuff.js ,這是內容:

$(document).ready(function () {
    $('.newsticker').newsTicker();
});

然后在解決方案資源管理器上我做了:

添加>新文件夾

這個名字是js。 在這個文件夾中,我從硬盤中添加了3個js類型的文件,並將它們添加為現有項目。

我也將文件mystuff.js拖到js文件夾中。

現在當我運行我的程序時,在大多數情況下99%,我在Chrome窗口上收到此錯誤:

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:62939/
Physical Path      D:\C-Sharp\Web\WebApplication1\WebApplication1
Logon Method       Anonymous
Logon User     Anonymous
Request Tracing Directory      C:\Users\bout0_000\Documents\IISExpress\TraceLogFiles\WEBAPPLICATION1

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 »

用Google搜索了一個小時的解決方案來解決它,但一無所獲。 正如有人在其中一個論壇中所說的那樣,嘗試將命令提示作為管理員:

1.)以管理員身份運行命令提示符。
2.)復制並粘貼以下文本“C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ aspnet_regiis.exe -i”

但是當我運行這一行時,我收到的消息是它無法在此操作系統上運行。 我有Windows 8 64位。

然后我嘗試了這個:

  1. 打開IIS(類型InetMgr)

但是當我制作Run並輸入inaside InetMgr我收到的消息是它不存在。 我之前從未安裝過它。

還有什么可能是問題?

編輯**

在Webform1.aspx中我更改了html行:

<html xmlns="http://www.w3.org/1999/xhtml">

至:

<html xmlns="http://localhost:*/webform1.aspx">

然后它工作了一次,但后來我去了文件mystuff.js並改為:

$(document).ready(function () {
        $('.newsticker').newsTicker();
    });

至:

$(document).ready(function () {
    $('.newsticker').newsTicker({
        row_height: 48,
        max_rows: 2,
        speed: 600,
        direction: 'up',
        duration: 4000,
        autostart: 1,
        pauseOnHover: 0
    });
});

運行程序並在chrome中再次獲取錯誤:

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:62939/
Physical Path      D:\C-Sharp\Web\WebApplication1\WebApplication1
Logon Method       Anonymous
Logon User     Anonymous
Request Tracing Directory      C:\Users\bout0_000\Documents\IISExpress\TraceLogFiles\WEBAPPLICATION1

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 »

即使我現在將文件mystuff.js中的內容更改為在Chrome窗口中獲取錯誤消息之前的內容。

您需要將頁面命名為default.aspx

或在您的網址http://中輸入當前頁面。 localhost: * /webform1.aspx

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM