Open infofromca opened 9 years ago
Got the same thing yesterday, and figured out why, so this one is easy. Open the project and change the target framework to 4.5.1.
my all projects have targeted to 4.5.1
also 500 for favicon.ico
Does your folder have a web.config with a StaticFile handler configured? Something like:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
just retested it with newest 1.x today, the same issue. web.config is no problem
I've had the same problem trying to use Bootstrap theme in Orchard (all using the latest versions directly from github, so even more recent than orchard 1.10 and Bootstrap theme 3.3.5).
To find out the real error under the 500, in the Orchard web.config, comment out the line:
<!-- Prevent IIS 7.0 from returning a custom 404/500 error page of its own. -->
<!--<httpErrors existingResponse="PassThrough" />-->
Then you can see the real error in the browser by requesting one the individual files in folder Scripts, Content or Styles, for example:
http://localhost:30321/OrchardLocal/Themes/PJS.Bootstrap/Content/Swatches/journal_th.png
The error I get is:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'StaticFile'
Config File \\?\C:\.......\Orchard-1.10.x- 2440e68\src\Orchard.Web\Themes\PJS.Bootstrap\Content\web.config
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
So rtpHarry was on the right track.
To fix this, I've added
<remove name="StaticFile"/>
above each of the
<add name="StaticFile"....
in all web.config files in the Bootstrap Theme.
What I don't understand is other themes, such as TheThemeMachine, also have child web.config in subfolder Styles for example, and they don't cause a problem when used. So what other settings somewhere affects this? I'm discussing this on the Bootstrap theme ticket: https://github.com/psenechal/PJS.Bootstrap/issues/12
Fixed it NOW it works with Orchard 1.9.3 or 1.10 or dev build from today. Fully tested Zip file with fixed PJS.Bootstrap for 1.10 adding JetBrains.Annotations also you should add it to Orchard with package manager. ZIp file for PJS.Bootstrap
Read below as this is how you fix old modules also.
Add PJS.Bootstrap as a new project in VS. 1.0 or dev and look at the references. Core and Framework have old references MVC is version 4.0.0.0. Remove then add correct ones. For MVC just remove MVC reference then use package manager to add MVC 5.3.0 and it will add MVC and the other updated correct assemblies for PJS.Bootstrap not Orchard PJS.Bootstrap.csproj is outdated Change `<?xml version="1.0" encoding="utf-8"?>
added this file in child theme
using Orchard.UI.Resources; namespace Guang.BootstrapBase { public class ResourceManifest : IResourceManifestProvider { public void BuildManifests(ResourceManifestBuilder builder) { var manifest = builder.Add(); manifest.DefineScript("myCustom").SetUrl("mycustom.js").SetDependencies("jQuery"); } }
}
then Script.Require("myCustom"); in a .cshtml file in child theme
got this:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)