Подтвердить что ты не робот

Каталог '/website/App_Code/' не разрешен, поскольку приложение предварительно скомпилировано

Как я могу решить проблему ниже, которую я получаю при запуске моего предварительно скомпилированного веб-приложения?

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
4b9b3361

Ответ 1

В зависимости от вашего случая существует три возможных сценария:

см. эту ссылку http://www.beansoftware.com/ASP.NET-FAQ/Directory-App_Code-Not-Allowed.aspx

В принципе, если вы предварительно скомпилировали свое приложение, то не будет папкой App_Code. Если вы добавили его позже, вы должны удалить его.

ИЛИ

Может быть каким-то образом файл precompiled.config сделал это для производства. Удаление этого файла должно устранить ошибку каталога App_Code.

Ответ 2

Удаление файла precompiledApp.config должно решить вашу проблему.

Ответ 3

В моем случае, я ошибочно, принудительно опубликовал класс, который вызвал эту проблему.

Решение состояло в том, чтобы сделать обновление для класса-нарушителя, а затем опубликовать снова с помощью опции "Удалить неиспользуемые файлы с сайта назначения". (Который находится под вариантами публикации для публикации)

Ответ 4

В моем случае я скомпилировал с опцией "ASPX files updateable", которая была выбрана OFF. Я предполагаю, что мой веб-сайт IIS работал, не понравилось.

После того, как я перекомпилировал с опцией "ASPX файлы обновлены", опция включена, проблема исчезла.