Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

windows

iis

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.

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

If I

telnet localhost 80

Then at the blank screen

GET / <enter>

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

If I enter garbage instead of a GET request I get the following 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.

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

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:

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.

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.

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).

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.

Thanks for your time...

like image 720
Matt Cofer Avatar asked Sep 17 '09 17:09

Matt Cofer


2 Answers

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.

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.

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.

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.

like image 164
Matt Cofer Avatar answered Nov 09 '22 10:11

Matt Cofer


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.

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 Roles node
  3. Right-click Web Server (IIS) node to view context menu
  4. Select Add Role Services from the context menu
  5. When the Add Role Services window opens, navigate to Web Server > Common HTTP Features
  6. Enable Static Content
  7. Click Next
like image 37
Aaronster Avatar answered Nov 09 '22 10:11

Aaronster