windows Win7下的IIS 7.5 Prof. 64bit Returning Blank Page(根本没有HTML)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1440144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:44:24  来源:igfitidea点击:

IIS 7.5 under Win7 Prof. 64bit Returning Blank Page (No HTML at all)

windowsiis

提问by Matt Cofer

I am trying to setup my development environment in Windows7 and am having trouble getting IIS to work. I have set everything up like I have been doing since IIS6 so I have the basics down. My problem must be in something that has changed between IIS7 and IIS7.5 or in the OS.

我正在尝试在 Windows7 中设置我的开发环境,但无法让 IIS 正常工作。我已经像从 IIS6 以来所做的那样设置了所有内容,因此我掌握了基础知识。我的问题一定是在 IIS7 和 IIS7.5 之间或操作系统中发生了变化。

None of my websites will return html. Not the default site and not a newly added site.

我的网站都不会返回 html。不是默认站点,也不是新添加的站点。

If I

如果我

telnet localhost 80

Then at the blank screen

然后在黑屏

GET / <enter>

I get nothing, not a single header or HTML element.

我什么也没得到,没有一个标题或 HTML 元素。

If I enter garbage instead of a GET request I get the following HTML:

如果我输入垃圾而不是 GET 请求,我会得到以下 HTML:

HTTP/1.1 400 Bad Request Content-Type:
text/html; charset=us-ascii Server:
Microsoft-HTTPAPI/2.0 Date: Thu, 17
Sep 2009 17:04:01 GMT Connection:
close Content-Length: 326

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad
 Request</TITLE> <META
 HTTP-EQUIV="Content-Type"
 Content="text/html;
 charset=us-ascii"></HEAD>
 <BODY><h2>Bad Request - Invalid
 Verb</h2> <hr><p>HTTP Error 400. The
 request verb is invalid.</p>
 </BODY></HTML>

So that proves IIS is there and handling requests on port 80.

这证明 IIS 存在并处理端口 80 上的请求。

In my IIS Logs path, I have no files at all. So for whatever reason logs aren't being written.

在我的 IIS 日志路径中,我根本没有文件。因此,无论出于何种原因,都没有写入日志。

If I view the Basic Settings on the Web Site in IIS Manager then click the Test Connection button I get an error related to permissions:

如果我在 IIS 管理器中查看网站上的基本设置,然后单击测试连接按钮,我会收到与权限相关的错误:

The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that \$ has Read access to the physical path. Then test these settings again.

服务器配置为使用带有内置帐户的直通身份验证来访问指定的物理路径。但是,IIS 管理器无法验证内置帐户是否具有访问权限。确保应用程序池标识对物理路径具有读取权限。如果此服务器已加入域,并且应用程序池标识为 NetworkService 或 LocalSystem,请验证 \$ 对物理路径具有读取访问权限。然后再次测试这些设置。

My AppPool is running as ApplicationPoolIdentity which doesn't seem to be a real user, so I can't give ApplicationPoolIdentity file permissions. I did as a test give IIS_IUSR and everybody else I could find full access to the path.

我的 AppPool 作为 ApplicationPoolIdentity 运行,它似乎不是一个真正的用户,所以我不能给 ApplicationPoolIdentity 文件权限。我做了一个测试,让 IIS_IUSR 和其他所有人都可以找到对路径的完全访问权限。

No matter what I have done up to this point, I have not seen IIS say the permissions are correct. However, I have also never seen an error, especially not a permissions error (300s).

到目前为止,无论我做了什么,我都没有看到 IIS 说权限正确。但是,我也从未见过错误,尤其是权限错误(300 秒)。

So, any ideas? I have tried to completely remove IIS, c:\inetpub and then reinstall everything. I am basically doing the default setup here, so it must be something simple.

那么,有什么想法吗?我试图完全删除 IIS,c:\inetpub,然后重新安装所有内容。我基本上是在这里做默认设置,所以它一定很简单。

Thanks for your time...

谢谢你的时间...

回答by Matt Cofer

I solved it. For anybody else having the issue, here is what I did.

我解决了。对于有问题的其他人,这就是我所做的。

First to replicate the issue: I was installing IIS by choose "ASP.NET" in the Add/Remove Windows features menus. This was selecting everything needed for IIS to run .NET apps, but interestingly it couldn't serve static pages (.html, css, js etc.) My test page was just a hello world .html page, so that is why it wasn't being served.

首先复制这个问题:我通过在“添加/删除 Windows 功能”菜单中选择“ASP.NET”来安装 IIS。这是选择 IIS 运行 .NET 应用程序所需的一切,但有趣的是它不能提供静态页面(.html、css、js 等)我的测试页面只是一个 hello world .html 页面,所以这就是为什么它不是没有被送达。

To fix it: To enable serving of Static content you must specifically choose "Static Content" under Common HTTP Features in the same Add/Remove Windows Features list. Once you do this my test page worked fine.

修复它:要启用静态内容服务,您必须在同一添加/删除 Windows 功能列表中的常用 HTTP 功能下特别选择“静态内容”。一旦你这样做了,我的测试页面就可以正常工作了。

In summary: I don't understand how a typical .NET would run without static content (CSS, Images, Javascript), so I don't know why MS wouldn't include Static Content by default when choosing ASP.NET. Perhaps my workflow in installing IIS was wrong.

总结:我不明白典型的 .NET 在没有静态内容(CSS、图像、Javascript)的情况下如何运行,所以我不知道为什么 MS 在选择 ASP.NET 时默认不包含静态内容。也许我安装 IIS 的工作流程是错误的。

I'm sure there was a way to trace the flow of the request to find static content requests were getting blocked, but I don't know how to do that.

我确信有一种方法可以跟踪请求流以查找静态内容请求被阻止,但我不知道如何做到这一点。

回答by Aaronster

Matt Cofer's resolution is correct: in order to view static content you must have installed the Static Content feature during your initial installation. However, I found that Add/Remove features did not work for me: it only showed a subset of features and nothing to do with IIS.

Matt Cofer 的解决方案是正确的:为了查看静态内容,您必须在初始安装期间安装静态内容功能。但是,我发现添加/删除功能对我不起作用:它只显示了一个功能子集,与 IIS 无关。

So... here's another way to install Static Content:

所以......这是安装静态内容的另一种方法:

  1. Open Server Manager
    • Start Menu > type "server manager" in search field > click resulting link
  2. Expand the Rolesnode
  3. Right-click Web Server (IIS)node to view context menu
  4. Select Add Role Servicesfrom the context menu
  5. When the Add Role Serviceswindow opens, navigate to Web Server > Common HTTP Features
  6. Enable Static Content
  7. Click Next
  1. 打开服务器管理器
    • Start Menu > type "server manager" in search field > click resulting link
  2. 展开角色节点
  3. 右键单击Web 服务器 (IIS)节点以查看上下文菜单
  4. 从上下文菜单中选择添加角色服务
  5. 当“添加角色服务”窗口打开时,导航到Web Server > Common HTTP Features
  6. 启用静态内容
  7. 单击下一步