我有 Windows 8 64 位。我使用的是 Visual Studio 2012 专业版。
我创建了一个新的 Web 应用程序项目:
New > Project > ASP.NET Empty Web Application.
然后在创建项目后,我右键单击解决方案资源管理器:
Add > Web Form
这是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 文件:
在解决方案资源管理器上:
Add > JavaScript File
文件名为mystuff.js,内容如下:
$(document).ready(function () {
$('.newsticker').newsTicker();
});
然后在解决方案资源管理器上我做了:
Add > New Folder
名字是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.) Run a command prompt as Administrator.
2.) Copy and paste the following text “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i”
但是当我运行这条线时,我收到消息说它无法在此操作系统上运行。我有 Windows 8 64 位。
然后我尝试了这个:
- Open IIS (Type InetMgr)
但是当我运行并输入 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
或者在您的 url 中输入当前页面 http://。本地主机:*/webform1.aspx
关于c# - 我在 Chrome 中不断收到错误 : HTTP Error 403. 14 - 禁止使用 Web 应用程序 Visual Studio 2012,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22263464/