Azure-System.MethodAccessException: Attempt by security transparent method

February 06, 2015 by Anuraj

.Net .Net 4.0 ASP.Net ASP.Net MVC Windows Azure

Today I faced a strange issue, after publishing an empty ASP.NET MVC application to Azure WebSite.

When I tried to browse the page I got an exception like this -

Attempt by security transparent method ‘System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()’ to access security critical method ‘System.Web.WebPages.ApplicationPart..ctor(System.Reflection.Assembly, System.String)’ failed.

Here is the screenshot

System.MethodAccessException: Attempt by security transparent method

This issue was resolved by changing the file publish options.

File Publish Options

Select the “Remove additional files at destination” checkbox.

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub