Could not load file or assembly 'App_Code' or one of its dependencies


  • Hello!

    I made a web site with VS2010 and publish it on IIS7.

    But when I publish this on the server, I get this error ::

    Could not load file or assembly 'App_Code' or one of its dependencies. The system cannot find the file specified.

    Anyone has an idea about what could be causing this?

    Please help me :(


    Thursday, November 01, 2012 7:44 AM

All replies

  • You may not have a license to install the application called by App_Code.  For example if your code was using the Excel Application and there wasn't a license on the Server for Microsoft Office you may get an error like the one you are getting.  The publish application doesn't deploy application and files that are put into a project folder.  To deploy files and application not part of a project you have to make a ZIP file containing these files and the visual Studion Project.  Then you have to unpack the ZIP file on the installation computer and run setup.exe.


    Thursday, November 01, 2012 9:03 AM
  • i didn't use application like MS Office ...

    only show food images from Database according to the food menu types ...

    Shwe Nann Thu

    Thursday, November 01, 2012 9:07 AM
  • What is your connection string to the database?  Where is the database located? You may be missing a driver required to connect to the database.  If your database is Access, you still could be missing a license.


    Thursday, November 01, 2012 9:10 AM
  • My connection string is

    string connectionStr = @"Data Source=.\sqlexpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\DBYDining.mdf;Integrated Security=True";

    I didn't use Access ...

    This site is smoothly running via web application in VS 2010 IDE ...

    But not available in IIS after web publish to that :(

    Shwe Nann Thu

    Thursday, November 01, 2012 9:21 AM
  • where is SQLexpress installed? (@"Data Source=.\sqlexpress).  The first period is using a default folder.  Try changing the sqlexpress to be a full pathname.  The code is expecting sqlexpress to be in the visual studio project folder.  The visual Studio publish will not deploy files and applications just randomly placed in the project folder(s).


    Thursday, November 01, 2012 9:33 AM
  • yes, i will try to give full pathname ...

    if not okay, let me ask again :(

    Shwe Nann Thu

    Thursday, November 01, 2012 9:35 AM
  • didn't get :(

    showing the previous error ...

    Shwe Nann Thu

    Friday, November 02, 2012 8:53 AM
  • I think the problem is with an access priviledge.  The database file itself may be in a folder your visual Studio Application doesn't have access to.  You may want to try running your application with admin priviledge.  You may have to make the folder shared.
    Also your connection string may need to contain the login information for the database.  See webpage below for different connection strings.  Use a connection string the contains the account and password.  The pop up login windows may not work with a visual studio application.


    If you plans are to access the database remotely I would set up a IP address (or URL) to connect to the database.


    Friday, November 02, 2012 9:54 AM
  • Thank you so much ...

    I will try to do like that ...

    Shwe Nann Thu

    Friday, November 02, 2012 10:34 AM