简体   繁体   中英

IIS 7.5 and Razor Site: 500 errors for CSS and JS

For some reason, when I deploy my Razor MVC web site to my Windows 2008 R2 server, I'm getting 500 internal server errors for all CSS and JS. I'm not sure why, because I've done the following:

  • Enabled static content in IIS
  • Enabled anonymous access, with the default ID being the application pool identity and given that identity read/write permission to the folders
  • Ensured my static content handler was setup correctly

What other problems could it be? How can I even debug this to see what the actual error is? Even though I have an Application_Error handler, nothing is getting logged. And IIS logs doesn't give me the error info?

Thanks.

Mime-Types were my trouble

I had the same problem. My css and js was not delivered. Server says internal error.

I found out that i added the mimetype for mp4 in the global settings of the iis and also added the mime type in one of my websites as well. That was a problem. This mime-type can only exist in the website or global, not both. I deleted tehe global mimetype and everything worked like it should be.

Hope to help some guys of you.

Just found, that I've added to web.config *.woff MIME for IIS 7.5, so when deploying on IIS8, it's causes static files error. After removing that from web.config everything is fine.

I got 500 errors because I added this below to my web.config. After I removed it, I got passed the error.

<staticContent>
  <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>

To rule out one basic permissions situation, try this:

  1. Select your web site and go into Basic Settings.
  2. Take note of which application pool your site is running under.
  3. Exit out of there and select the Application Pools node.
  4. Find the application pool for your site, and take note of which identity (account) that application pool is running under.

If the account is a specific user identity -- in other words, if it's not a built-in account (such as ApplicationPoolIdentity, Network Service, Local System, etc) then:

  1. Launch your Local Users and Groups.
  2. Find and open the local IIS_IUSRS group.
  3. If the account in question is not a member of the group, add it.

If you are on your local server and taking this error, please check if you have any missing packages. Catch errors in global.asax and if neccessary reload all packages with;

Update-Package -reinstall

in Package manager console.

Hope it helps.

重新安装 IIS 解决了该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM