4

I have an ASP.NET website that is XCOPIED to production. I do not publish this website using Visual Studio. I just copy all the aspx and code behind pages to production. There is no publish config file. My production server is running IIS 7.5, integrated pipeline. If I add an App_Code directory to the root directory of the website I get the following error:

The directory /App_Code is not allowed because the application is precompile

Another issue I noticed is that my global.asax file's Application_Start is not being called. (I know this for sure as I Throw an Exception from it)

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
  • Check your `web.config` file, and also ensure that you have defined an Application Scope in IIS. `App_Code` can only exist in the root of an application scope, not just in the root of your website. – Dai Mar 14 '13 at 23:48
  • I have not defined an application scope in my web.config. The root of my website is the root of my application. – Brian Ogden Mar 14 '13 at 23:56
  • Possible duplicate of [The directory '/website/App\_Code/' is not allowed because the application is precompiled](http://stackoverflow.com/questions/24484888/the-directory-website-app-code-is-not-allowed-because-the-application-is-pre) – Ryan Gates Nov 06 '15 at 15:58

1 Answers1

12

Somehow a precompiled.config file had made it to production. Don't know how but deleting that file resolved the App_Code directory error and the Application_Start method not being called.

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
  • 2
    That might happen if you accidentally turned on the option to ***not*** delete all files in the target location. And this answer solved my issue. Thank you! – Ian Boyd Oct 02 '13 at 18:39
  • ***Web Site project or Web Application*** ? – Kiquenet Jul 02 '18 at 09:54