How to run XPO in hosting environment with some CAS restrictions?
Here’s the small code snippet on enabling/disabling some XPO features depending on the hosting environment. Just plug it in your kernel initialization routine and you should be fine.
try
{
new ReflectionPermission( ReflectionPermissionFlag.ReflectionEmit).Demand();
new SecurityPermission( SecurityPermissionFlag.ControlEvidence).Demand();
}
catch (SecurityException)
{
XpoDefault.UseFastAccessors = false;
}
Update: If you use data caching, then you might need to manually set the XPO cache size for your DataCacheNode instances (otherwise XPO will attempt to detect it automatically via the code that cannot run under the Medium Trust). Here’s the sample code snippet:
if (manualCacheSizeMb > 0)
{
node.TotalMemoryPurgeTreshhold = 0;
node.TotalMemoryNotPurgeTreshhold = manualCacheSizeMb*1024*1024;
}
So far these are the only CAS-related problems that were encountered while deploying current xLim 2 implementation (Server+WebUI) on the CrystalTech accounts.
No comments yet.
Leave a comment
Search
Archives
Recent Comments
- aCoder on Extension methods for interfaces
- Requirements for the Photon .NET project | Rinat Abdullin on IRepository, cross-cutting concerns and flexibility
- Nicholas Blumhardt on Extension methods for interfaces
- aCoder on IRepository, cross-cutting concerns and flexibility
- Rinat Abdullin on Blog upgraded
- Rinat Abdullin on Extension methods for interfaces
- IRepository, cross-cutting concerns and flexibility | Rinat Abdullin on Extension methods for interfaces
- Bill Pierce on Blog upgraded
- aCoder on Extension methods for interfaces
