2014-06-30 9 views
23

Come posso risolvere il problema riportato di seguito che viene visualizzato quando eseguo la mia app Web precompilata?La directory '/ website/App_Code /' non è consentita perché l'applicazione è precompilata

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 
+0

possibile duplicato di [Errore relativo alla precompilazione da un sito Web ASP.NET che NON è precompilato] (http://stackoverflow.com/questions/15422217/precompilation-related-error-from -un-asp-net-sito-che-è-non-precomplied) – CrazyPyro

risposta

25

A seconda del caso, ci sono tre possibili scenari:

Vedi questo link http://www.beansoftware.com/ASP.NET-FAQ/Directory-App_Code-Not-Allowed.aspx

In sostanza, se si precompilato la vostra applicazione, ci shoudn't essere una cartella App_Code. Se lo hai aggiunto in seguito, dovresti eliminarlo.

O

Può essere qualche modo un file precompiled.config ha reso alla produzione. L'eliminazione di quel file dovrebbe risolvere l'errore di directory App_Code.

8

L'eliminazione del file "precompiledApp.config" dovrebbe risolvere il problema.

0

Nel mio caso, ho erroneamente forzato Pubblica una classe, che ha causato questo problema.

La soluzione era di effettuare un aggiornamento sulla classe all'origine dell'errore, quindi di nuovo Pubblica con l'opzione "Elimina file non utilizzati dal sito di destinazione". (Che è sotto le opzioni modali di pubblicazione)