Cassini exceptions on medium trust ASP.NET MVC application using Linq-to-SQL

1

I am receiving the following exception trying to browse a medium trust ASP.NET MVC application (using Linq-to-SQL) on Cassini 3.5.0.2:

Could not load file or assembly 'Cassini, Version=3.5.0.2, Culture=neutral, PublicKeyToken=da0fefd60d522a7d'
or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

with an inner exception:

Execution permission cannot be acquired.

Stack trace:
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)

The same application works on IIS7 and on internal VS2008 web server. Cassini works without any problems with ASP.NET MVC application which are not using Linq-to-SQL.

Both the ASP.NET MVC application and the Linq-to-SQL repository project have [assembly: System.Security.AllowPartiallyTrustedCallers] applied in order to work in medium trust.

Has anyone any clue about this problem?

EDIT

The exception is thrown on this line from Server.cs:

return appManager.CreateObject(appId, hostType, virtualPath, physicalPath, false);
asp.net-mvc
visual-studio-2008
linq-to-sql
cassini
asked on Stack Overflow Aug 2, 2009 by alexandrul

1 Answer

4

[http://blogs.msdn.com/dmitryr/archive/2009/04/23/cassini-support-for-friendly-urls-routing.aspx#9855758]

Unfortunately this is a side-effect of the single-EXE Cassini. In the worker app domain Cassini EXE is treated as untrusted code.

To make it work in Medium trust, you need either tinker with Medium Trust definition (to allow Assemblies signed by your key to get Full Trust) or go back to putting Cassini into GAC, as in previous versions.

Thanks,

Dmitry

answered on Stack Overflow Aug 2, 2009 by (unknown user)

User contributions licensed under CC BY-SA 3.0