Offroadcode / umbraco-content-security-policy

Code that generates a Content-Security-Policy header, but allows front-end developers to easily edit it through a straightforward config file.
4 stars 2 forks source link

YSOD upon install zip #3

Closed colgibson closed 6 years ago

colgibson commented 6 years ago

Hi,

I downloaded the zip file from https://our.umbraco.org/projects/developer-tools/easy-content-security-policy/ and went to Developer > Package > Install Local and then selected the zip file but it threw a red system administrator error message and now shows a YSOD with the following:

Server Error in '/' Application.
Could not load all types from "ContentSecurityPolicy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" due to LoaderExceptions, skipping:
. System.TypeLoadException on umbraco.interfaces.IDiscoverable: Could not load type 'umbraco.interfaces.IDiscoverable' from assembly 'interfaces, Version=1.0.6185.24081, Culture=neutral, PublicKeyToken=null'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Reflection.ReflectionTypeLoadException: Could not load all types from "ContentSecurityPolicy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" due to LoaderExceptions, skipping:
. System.TypeLoadException on umbraco.interfaces.IDiscoverable: Could not load type 'umbraco.interfaces.IDiscoverable' from assembly 'interfaces, Version=1.0.6185.24081, Culture=neutral, PublicKeyToken=null'.

D'oh!, I've just spotted the following:

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36430

and the package says it needs v4.5. I thought I was on v4.5 with it being umbraco v7 but I guess not.

Can you tell me how I would undo the failed package installation from the YSOD so I can try to apply CSP manually rather than via this package?

Thanks

Col

steroberts89 commented 6 years ago

Hi Col,

Umbraco 7 should be 4.5 I think your problem is probably more to do with the umbraco version which you are running rather than .net version (.net5 4.5 uses the 4.0 CLR) and we may be using some internal logic which is only available after a given version

Looking at the code, we have a dependency on umbraco.interfaces.IDiscoverable which appeared in the 7.6 minor release of umbraco

To manually uninstall you'll want to delete the following files

Edit your web.config file and remove the lines which mention "ContentSecurityPolicyModule" there should be two references, one in /configuration/system.web/httpModules and another in //configuration/system.webServer/modules

Thanks Stephen

colgibson commented 6 years ago

There was no sign of any changes to the web.config but I removed those other 2 files and the YSOD has now gone, thanks.

I think it might be worth mentioning the umbraco v7.6+ requirement in the installation section on the Github readme page :)