Sorun
.NET Framework’de kullandığınız versiyona göre bazı fonksiyonların iptal edildiği ile karşılaşmışsınızdır. MaestroPanel her zaman .NET Framework’ün son versiyonunu kurar ve siz uygulamanızı çalıştırdığınızda en yeni .NET versiyonu ile çalışırsınız.
.NET Framework her ne kadar geriye dönük uyumluluk sağlasada çok kritik yerlese eski fonksiyonları keni içinde iptal eder (obsoleted) ve kullanamasınız. Uygulamanız bu method’lardan birine denk geldiğinde aşağıdaki gibi bir hata alırsınız.
This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information. 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.NotSupportedException: This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
Çözüm
Bu durumda root web.config içinde legacyCasModel’i geriye dönük bir uyumlulukta çalışmasını söylememiz lazım ki uygulamanız da geriye dönük uyumlulukta çalışsın.
Bunun için;
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
dosyasına gelin.
Shared Bir hizmet veriyorsanız yaptığımız değişikliği tüm Domain’ler için aktif olmaması gerekir. Dolayısı ile sadece belirli lokasyonda çalışması için aşağıdaki gibi düzenleyin.
</configuration> tag’înın hemen üzerine aşağıdaki düzenlemeyi yapın.
<location path="domaintest.com"> <system.web> <trust legacyCasModel="true"/> </system.web> </location>
Bu aşamadan sonra domaintest.com sitesi legacyCasModel’de çalışacaktır.
Not: Uygulamanız hem x86 hem de x64 olarak çalışabilir o nedenle hem Framework hem de Framework64 klasörleri içindeki iki web.config’de değişiklik yapmalısınız.