web-dev-qa-db-fra.com

Le répertoire '/ website/App_Code /' n'est pas autorisé car l'application est précompilée.

Comment puis-je résoudre le problème ci-dessous que je rencontre lorsque j'exécute mon application Web précompilée?

Server Error in '/CRM' Application.
    The directory '/CRM/App_Code/' is not allowed because the application is precompiled.
    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.Web.HttpException: The directory '/CRM/App_Code/' is not allowed because the application is precompiled.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the Origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [HttpException (0x80004005): The directory '/CRM/App_Code/' is not allowed because the application is precompiled.]
       System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +8777420
       System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
       System.Web.Compilation.BuildManager.CompileCodeDirectories() +387
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +248

    [HttpException (0x80004005): The directory '/CRM/App_Code/' is not allowed because the application is precompiled.]
       System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
       System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +421
       System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +605

    [HttpException (0x80004005): The directory '/CRM/App_Code/' is not allowed because the application is precompiled.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8946484
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
       System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
30
shalsoft

Selon votre cas, trois scénarios sont possibles:

voir ce lien http://www.beansoftware.com/ASP.NET-FAQ/Directory-App_Code-Not-Allowed.aspx

En gros, si vous avez précompilé votre application, il ne devrait pas y avoir de dossier App_Code. Si vous l'avez ajouté plus tard, vous devez le supprimer.

OU 

Peut-être en quelque sorte, un fichier precompiled.config a été mis en production. La suppression de ce fichier devrait résoudre l’erreur de répertoire App_Code.

27
StackTrace

La suppression du fichier "precompiledApp.config" devrait résoudre votre problème.

12
Vlad Irimia

Dans mon cas, par erreur, j'ai forcé Publier une classe, ce qui a causé ce problème.

La solution consistait à effectuer une mise à jour de la classe incriminée, puis à publier à nouveau avec l'option "Supprimer les fichiers inutilisés du site de destination". (Qui est sous les options modales de publication)

1
Munawar Ali

Dans mon cas, j'ai compilé avec l'option "Les fichiers ASPX peuvent être mis à jour" est désactivée. Je suppose que IIS sur lequel mon site Web tournait ne l’aimait pas. 

Une fois recompilé avec l'option "Les fichiers ASPX peuvent être mis à jour" activée, le problème a disparu.

0
George