This project is read-only.

(resolved) CSS not working...

Topics: Troubleshooting
Apr 1, 2011 at 7:23 PM

I just installed Orchard, and noticed that the CSS doesn't seem to be working. The link in the generated HTML is there, but when I navigate to it (, I get a Server 500 error... Here's the details. Apparently the 'StaticFile' key is added elsewhere. Has anyone encountered this problem or have a suggestion about how to solve without manually adjusting the web.configs?

Error Summary

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

<fieldset><legend>Detailed Error Information</legend>
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x800700b7
Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'StaticFile'
Config File \\?\C:\HostingSpaces\houset\\wwwroot\Themes\TheThemeMachine\Styles\web.config
Requested URL
Physical Path C:\HostingSpaces\houset\\wwwroot\Themes\TheThemeMachine\Styles\Site.css
Logon Method Not yet determined
Logon User Not yet determined
<fieldset><legend>Config Source</legend>
   17:       -->
   18:       <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
   19:     </handlers>
Apr 1, 2011 at 7:30 PM

Did you use the web.config that comes with Orchard at the root of your site?

Apr 1, 2011 at 7:32 PM

Yeah, used the one from the zip. Also, I just walked up the tree from the Styles folder to check the web.config's in those directories. Nothing specifies a key named "StaticFile" up the chain, so not sure where it's duplicated...

Apr 1, 2011 at 7:36 PM

Maybe your hoster has a policy up the chain to not allow that setting to be changed in child configs? Can you check with them?

(never seen that happen before)

Apr 1, 2011 at 7:40 PM

I'll check. That would surprise me. I've been able to change things like that on other projects. The host is pretty open. I found out today that I DO in fact have access to the IIS server directly through Remote IIS Manager, which is nice. In the meantime, I renamed that web.config file and now everything is working. Not sure if that will affect things in other places, but it seems to have solved the problem.


Apr 1, 2011 at 7:44 PM

Well, it should be more or less ok but you'll probably have other files from other directories that won't be served for the same reason. There is a security risk here in that if you had to do the same manipulation in, say the media folder, which allows uploads from some users, you might allow for code execution that you wouldn't expect otherwise. It would be good to get to the bottom of this.

Apr 1, 2011 at 8:02 PM

Agreed. I'll post what the conclusion is.

Apr 1, 2011 at 11:06 PM

Ok, so it's all working as designed now. You had asked if I was using the default web.config, so that prompted me to reload the files to the server again and overwrite the ones there. This did the trick... So, I'm guessing the hosting system must have done something to the Web.config while I was flipping bits and switches during troubleshooting... Anyway, it's all working now. Now I can actually start learning, and who knows, maybe even contribute something!! :) Thanks for all the help!

Apr 1, 2011 at 11:16 PM

Makes sense. Possible scenario: maybe you went to their control panel and did changes to site settings, which really edits web.config?

Apr 2, 2011 at 1:29 AM

Yep, that's exactly what I figure happened.