我的MVC c#項目存在一些問題。ASP.NET 4.0中的代碼訪問安全和動態數據錯誤
首先我收到此錯誤:級別2的透明度導致AllowPartiallyTrustedCallers程序集中的所有方法默認情況下變爲安全透明,這可能是此異常的原因。完成:
Attempt by security transparent method 'System.Runtime.Diagnostics.DiagnosticTrace..ctor(System.String, System.Guid)' to access security critical method 'System.Runtime.Diagnostics.EtwDiagnosticTrace..ctor(System.String, System.Guid)' failed.
Assembly 'System.ServiceModel.Internals, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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."
因此,我在互聯網上搜索和找到解決它的兩種可能性。第一個作品,包括assemblyinfo.cs
這個片段:
[assembly: System.Security.AllowPartiallyTrustedCallers]
,但沒有改變..
谷歌搜索我找到了第二個信息說,如果我在web.config
把它可能工作。
<trust legacyCasModel="true" level="Full" />
但是,當我把這些信息在web.config
我接受和錯誤,如
Dynamic operations can only be performed in homogenous AppDomain
,我不知道還有什麼做我必須做的......
我相信使用microsoft.practices.unity與ASP.NET 4.0和mvc 4,是問題的主要原因。但基於我的應用程序的工作方式,對我來說使用統一是必要的。
brgds!塞巴斯蒂安。
@DarinDimitrov你知道如何解決這個問題問題?,非常感謝你提前.. – 2012-02-27 06:30:08
@ marc-s謝謝你的ediition ...你有任何想法,爲什麼這可能嗎? brgds – 2012-02-27 07:33:36