IIS 7 Windows Server 2008 / CSS not loading in aspx

I learned several topics related to this problem, but I could not find an answer that worked for my problem, which is the following: I moved the Asp.Net 4.0 site to a new server (IIS 7, Windows Server 2008). It works fine on the server side, but the CSS stylesheet does not load. When I use firebug, I see the following from the side where css should be loaded

404 - No file or directory found.

The resource you are looking for may have been deleted, its name changed or temporarily unavailable.

Despite this message, I can display css content (in text) on the Internet (e.g. .. / Styles / button.css..etc)

I tried some solutions, such as mapping staticFile handlers in IIS or adding ASP roles in Server Manager (through the control panel).

Any help would be appreciated. Best regards.

+4
source share
3 answers

The articles / topics that you found say the same as Uali's answer, which is correct, but it does not always solve all problems. The problem is not just your CSS.

Before proceeding, be sure to include Static Content as indicated in another answer.

Then follow these steps in the IIS Manager window with the virtual directory selected.

  • Open handler mappings .
  • Click the Add Managed Handler button in the action pane on the right.
  • In the request path field, enter: *. css
  • In the type text box, type: System.Web.StaticFileHandler
  • In the name text box, enter any descriptive name you want, for example css fix .
  • Click OK.

Update: I also forgot to say that you can do the same for .jpg, .png, .gif or any other file types if necessary.

+8
source

Please ensure that static IIS content is enabled. To do this, follow these steps:

  • Open control panel
  • Click "Programs"
  • Click "Enable or Disable Windows Features" in "Programs and Features."
  • Open Internet Information Services → World Wide Web Service → General HTTP Features
  • Make sure Static content is checked, check the box if it is not.

Hope this helps you.

+8
source

The process of including static content in Windows 7 is different than the installation process on Windows Server 2008.

To install the Static Content component on Windows Server 2008 and Windows Server 2008 R2, follow these steps:

a. Open Server Manager, and then expand the roles. b. Right-click Web Server (IIS) and select Add Role Services. with. In the Web Server section, select the Static Content check box. e. Click Next to complete the installation.

Below is a complete step-by-step guide for both situations for reference. http://support.microsoft.com/kb/2196177

+3
source

Source: https://habr.com/ru/post/1432733/


All Articles