Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with MVC5 #23

Closed
azzlack opened this issue Nov 2, 2013 · 9 comments
Closed

Doesn't work with MVC5 #23

azzlack opened this issue Nov 2, 2013 · 9 comments

Comments

@azzlack
Copy link

azzlack commented Nov 2, 2013

The security model has changed in MVC5, giving the following error:

Server Error in '/' Application.

Attempt by security transparent method 'ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler()' to access security critical type 'System.Web.Mvc.MvcHandler' failed.

Assembly 'ClientDependency.Core.Mvc, Version=1.7.0.4, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.

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.TypeAccessException: Attempt by security transparent method 'ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler()' to access security critical type 'System.Web.Mvc.MvcHandler' failed.

Assembly 'ClientDependency.Core.Mvc, Version=1.7.0.4, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[TypeAccessException: Attempt by security transparent method 'ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler()' to access security critical type 'System.Web.Mvc.MvcHandler' failed.

Assembly 'ClientDependency.Core.Mvc, Version=1.7.0.4, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.]
    ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler() in x:\Projects\ClientDependency\ClientDependency\ClientDependency.Mvc\MvcFilter.cs:36
    ClientDependency.Core.Module.ClientDependencyModule.<ValidateCurrentHandler>b__0(IFilter f) in x:\Projects\ClientDependency\ClientDependency\ClientDependency.Core\Module\ClientDependencyModule.cs:108
    System.Linq.Enumerable.Any(IEnumerable`1 source, Func`2 predicate) +146
    ClientDependency.Core.Module.ClientDependencyModule.ValidateCurrentHandler(IEnumerable`1 filters) in x:\Projects\ClientDependency\ClientDependency\ClientDependency.Core\Module\ClientDependencyModule.cs:108
    ClientDependency.Core.Module.ClientDependencyModule.HandleRequest(Object sender, EventArgs e) in x:\Projects\ClientDependency\ClientDependency\ClientDependency.Core\Module\ClientDependencyModule.cs:49
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

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

DotNetOpenAuth has encountered same problem: http://stackoverflow.com/questions/19013429/dotnetopenauth-not-working-with-mvc-5-rc

According to that SO link, recompilation against MVC5 will solve the problem.

@Shazwazza
Copy link
Owner

Cool, will try to get to this and a few other issues next week!

@everdownpour
Copy link

I met same problem!
Have any method to fix?

@Shazwazza
Copy link
Owner

Sorry for the delay, will have a new version out this week

@Shazwazza
Copy link
Owner

I've just released another 1.7.x version but this is still not compatible with MVC5. I'm going to have to release a different version type because MVC5 requires ASP.Net 4.5 which would be a breaking change.

Looking into Nuget version targeting but to do all this and support .Net 4.0 with MVC4 and .Net 4.5 with MVC5 will require a new setup of the solution - still seeing how that is possible.

@akoska
Copy link

akoska commented Apr 16, 2014

Hi,

Do you plan to publish the newer version of the nuget package that is compatible with MVC5?

Thanks,
Ákos

@Shazwazza
Copy link
Owner

Have worked on it in the core, just haven't found the time to complete it. It of course works just fine with MVC5 but I need to finish multi-targeting the build

@Shazwazza
Copy link
Owner

I've released the beta for testing which works with MVC 4+ including MVC 5

To test install the beta's

Install-Package ClientDependency -Pre

Install-Package ClientDependency-Mvc -Pre

And all should work. If anyone can test then I'll release the full version asap. Thanks!

@ghost
Copy link

ghost commented Jun 11, 2014

This looks quite an old post but I'm having the same issues - I attempted to use the beta release but it just crashes with the following:

A section using 'configSource' may contain no other attributes or elements.

I have this in my web.config:

As this issue was closed, am I right in thinking that this package isn't being developed anymore?

@ghost
Copy link

ghost commented Jun 11, 2014

Ignore my last comment - the message was telling me exaclty what the problem was so once I resolved that, it compiled fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants