That assembly does not allow partially trusted callers

Mar 11, 2009 at 6:57 PM
Hi,

We wrote an application using WCSF and works fine on the development server.

However, when we deployed to a shared hosted server which configures their trust level at medium, the following message come out:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: That assembly does not allow partially trusted callers.

Source Error:

[No relevant source lines]

Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\857a9ec3\570be732\App_global.asax.qmilkevs.0.cs    Line: 0

Stack Trace:

[SecurityException: That assembly does not allow partially trusted callers.]
   Global..ctor() +0
   ASP.global_asax..ctor() in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\857a9ec3\570be732\App_global.asax.qmilkevs.0.cs:0


I contacted the hosting company and they replied  

"The assembly concerned should initially be recompiled with the following line added: [assembly:AllowPartiallyTrustedCallers] and this should get us past this error."


Would it be possible to give me some information on what chagnes I need to make? source code of WCSF?

Thanks

Mar 13, 2009 at 6:04 PM

Hi,

You can define the [assembly:AllowPartiallyTrustedCallers] attribute in each of the AssemblyInfo file of your projects but this might not solve the problem.

 

Unfortunately, WCSF running on Medium Trust environments was not a requirement taken into account for the version 2 of this factory. One of the problems is CWAB (the kernel of WCSF) uses reflection, which is not allowed in the default Medium trust level.

Perhaps, you may find useful the following codeplex thread that talks about this same issue:

·         WCSF hosted on medium trust site

 

As it is mentioned in the thread above, there is an item in the Issue Tracker that you should vote if you consider this issue is important. In this way, the p&p team may take into account this for the next version of the factory:

·         Ability to Deploy to Medium Trust Environments

 

Another way could be leaving a comment in the following post from Blaine Wastell (p&p Product Manager):

·         Roadmap for WCSF

 

Please, let me know if this helps.

 

Ezequiel Sculli

http://blogs.southworks.net/esculli/

Mar 13, 2009 at 7:14 PM
Thank you very much. The information is very helpful.