locked
App_Code not accessible when not in wwwroot dir RRS feed

  • Question

  • User-435213441 posted

    Hi
    I have to move some web sites from a server 2003 IIS 6 to a new Server2012 IIS 8.

    Unfortunately the website throws an error when trying to access the App_Code dir on the new server.

    The websites are not stored in the wwwroot directory.
    The Location is: D:\webs\website1
    App_code dir location is D:\webs\website1\App_Code

    Each website has it's own App_Code folder

    When I move the content of the App_Code folder to C:\inetpub\wwwroot\App_Code it's working
    But this is no option, because I have many websites which use all own App_Code folders.

    Is there a way to force/enable IIS to use App_Code folder outside wwwwroot?

    This worked on my old server perfectly and I have no idea how to make it work on the new server.

    Friday, October 23, 2015 9:58 AM

Answers

  • User37182867 posted

    @deadtroll
    maybe I should try this - but why is it running on 2003 II6 without problem (Folder structure is identic on both systems)?

    Only reason it should ever fail is when that web site is not configured to be an application. Its probable that your other system has the file structure as an app and your current does not.

    Just convert it to a web app, your problem will be solved.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 23, 2015 2:34 PM

All replies

  • User37182867 posted

    Are your sites marked as applications in IIS? Right click on their names and see if a option for "Convert to Application" comes up.

    Friday, October 23, 2015 10:53 AM
  • User-435213441 posted

    Yes -  "Convert to Application" comes up. But I did not try this so far.

    Friday, October 23, 2015 10:59 AM
  • User753101303 posted

    Hi,

    Also be as explicit as possible that is:

    gsundi

    throws an error

    That is? Which error or behavior do you see?

    gsundi

    when trying to access the App_Code

    That is? Do you mean trying to access a file stored in this folder using the browser? Having your code reading or writing something to this folder? Etc... This folder is intended to be used for source code compilation and AFAIK not being able to serve to a browser a file stored in this folder (if this is the kind of "access" you are talking about) is the expected behavior.

    Being more explicit would allow to know what happens exactly before trying to solve the issue you have. For now we just know that you have "an error" when trying to "access" this folder and so we have still to guess first what is the exact situation you see on your side.

    Friday, October 23, 2015 12:25 PM
  • User37182867 posted

    "Yes -  "Convert to Application" comes up. But I did not try this so far."

    convert the site to an application.

    If the web site is not an application then IIS won't look for or wire up anything from the App_Code dir. Hence the prefix name "App"

    Friday, October 23, 2015 12:53 PM
  • User-435213441 posted

    @PatriceSc
    About the error:
    I can surf some pages (.aspx), but as soon as I reach a page that is requesting code from my xyc.vb (located in App_Code) it tells me: BC30002 Typ XYZ not defined.
    I do not try to access a file in App_Code with the browser.

    @deadtroll
    maybe I should try this - but why is it running on 2003 II6 without problem (Folder structure is identic on both systems)?

    Another reason could be that AppPool is not authenticated to access App_Code. But don't know how to check that right now (have to do some research about it first)
    Found this additional info about the request in the log:
        User: 
        Is authenticated: False
        Authentication Type: 
        Thread account name: IIS APPPOOL\DefaultAppPool

    Friday, October 23, 2015 2:11 PM
  • User37182867 posted

    @deadtroll
    maybe I should try this - but why is it running on 2003 II6 without problem (Folder structure is identic on both systems)?

    Only reason it should ever fail is when that web site is not configured to be an application. Its probable that your other system has the file structure as an app and your current does not.

    Just convert it to a web app, your problem will be solved.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 23, 2015 2:34 PM
  • User-234406897 posted

    I am not sure you need to set the app-code folder as an application. I haven't seen this before.

    A website is an application and will inherit the properties throughout. You create new app to silo off different areas with different properties under the website.

    If you are getting an error then the first place to look is to look at the error and google it.

    Also check your file permissions. It could be that the files you are copying around don't have the correct NTFS permissions for that folder.

    Saturday, October 24, 2015 7:49 PM
  • User-234406897 posted

    ALso if you are doing a straight migration try using migration tools like web deploy.

    http://www.iis.net/downloads/microsoft/web-deploy

    Do it from the whole server level, if possible, to capture the applicationhost settings rather than just the website level.

    Saturday, October 24, 2015 7:56 PM
  • User-435213441 posted

    to make it short - I did try to convert it to a web app and now everything is fine. The web site (app) is running as expected.

    before that I also changed permissions of App_Code folder, but without success.

    So converting to a web app solved my problem.

    thank you all for taking time and helping me, and deadtroll for solving it!

    Monday, October 26, 2015 3:53 AM
  • User37182867 posted

    to make it short - I did try to convert it to a web app and now everything is fine. The web site (app) is running as expected.

    before that I also changed permissions of App_Code folder, but without success.

    So converting to a web app solved my problem.

    thank you all for taking time and helping me, and deadtroll for solving it!

    Your welcome. Its a common issue when setting up a new website in IIS. 

    Monday, October 26, 2015 7:41 AM