Orchard doesn’t seem to like anything in it’s web root except for it’s own content. Try it out – create a folder (I created /TestContent/) and then put a test from there (I created test.html) and try to access it. You’ll get a 404 error. Orchard “traps” all requests and effectively kills them if it doesn’t like them. That’s a bummer though if you want to drop some custom content on your site somewhere for some reason. Let’s see what we can do about it.
I created a default Orchard site. No changes and running the default recipe selected during the initial configuration.
I created a folder named “TestContent” so that it would be available at <orchardsite>/TestContent/
I created a simple HTML file named “test.html” so that it would be available at <orchardsite>/TestContent/test.html
I confirmed that I got a 404 error trying to access the file.
OK. So now let’s see what we can do to fix this issue. There was a lot of research and testing for a solution and I spare you those details and just show how I got past the error.
I surrounded <system.web> and <system.webServer> with location tags to prevent the settings from pushing to all subfolders…
<location inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>
...
<location inheritInChildApplications="false">
<system.webServer>
...
</system.webServer>
</location>
I also converted the /TestContent/ folder to an application in IIS. This can be done via many hosting control panels or directly through IIS (either on-server or via the IIS7 Remote Management tool).
Great, now my test URL works! But it seems also that the formatting within Orchard has broken. So…
I added another section to the web.config file. This time just below the ending location tag that I wrapped around the system.webServer section.
...
</system.webServer>
</location>
<!--
EDIT: Adding this next section to "fix" the Orchard formatting
-->
<location path="Themes">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script">
<remove name="StaticFile" />
</handlers>
</system.webServer>
</location>
<location path="Core">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script">
<remove name="StaticFile" />
</handlers>
</system.webServer>
</location>
<location path="Media">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script">
<remove name="StaticFile" />
</handlers>
</system.webServer>
</location>
<location path="Modules">
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers accessPolicy="Script">
<remove name="StaticFile" />
</handlers>
</system.webServer>
</location>
<!--
EDIT: Adding the above section to "fix" the Orchard formatting
-->
<runtime>
...
And then the Orchard formatting started working again… And the test page in the test folder still worked!
Problem solved? I think so. It seems that this solution works great for me. If you have a different experience with this solution please let a comment and share with the world.
Happy hosting!


Recent Comments