Hi @Cacenco, Michael I'm looking into this issue and will get back to you soon. Thank you for your patience.
HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception
Stack Trace:
[MethodAccessException: 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.]
System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule() +64
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: 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..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +919
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +172
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +854
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: 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..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +719
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9319.0
Windows development | Internet Information Services
2 answers
Sort by: Oldest
-
Danny Nguyen (WICLOUD CORPORATION) 8,725 Reputation points Microsoft External Staff Moderator
2026-08-26T03:32:36.5366667+00:00 -
Danny Nguyen (WICLOUD CORPORATION) 8,725 Reputation points Microsoft External Staff Moderator
2026-08-26T03:59:44.6066667+00:00 Hi @Cacenco, Michael ,
Thanks for posting the stack trace. I think this is an assembly version mismatch rather than an IIS configuration problem.
System.Web.WebPages.Administration.dllin your bin folder is likely a different version than the System.Web.WebPages.dll it calls into, so the .NET security transparency model blocks the call during pre-application start. This usually shows up after an MVC or Web Pages upgrade where the DLLs and the binding redirects inweb.configfell out of sync.A few things to try:
- Check the section of your
web.configand make sure the redirects forSystem.Web.Mvc,System.Web.WebPages,System.Web.WebPages.Razor, andWebMatrix.*point to the versions actually deployed in bin. - In Visual Studio, run Update-Package from the Package Manager Console so all the Web Pages assemblies land on the same version, then republish.
- If you are not using the Web Pages site administration feature, try deleting System.Web.WebPages.Administration.dll from bin. It is not required at runtime and removing it has resolved this for others.
If none of that helps, could you share:
- The section from your
web.config - The file versions of
System.Web.WebPages.dll,System.Web.WebPages.Administration.dll, andSystem.Web.Mvc.dllin your bin folder - What changed right before this started, such as a framework upgrade, a new publish, or a server patch
That will help confirm whether it is the mismatch or something else. You may also find this https://learn.microsoft.com/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 useful if this followed an MVC upgrade.
Let me know how it goes. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.
Thank you.
- Check the section of your