locked
Could not load type '_Default'

    Question

  • I've looked at countless blogs and forums and have tried everything and I still get the error: Could not load type '_Default'.

    I created an ASP.NET web site, using C# and when I go to the Default.aspx page in the browser I get the error. So far I have removed my lib environment variables from Windows System panel, checked with the VS2005 Cmd Prompt to make sure it's set correctly there, I build the web site, I have my Web.config file telling it debug=true, and so on. No matter what I do, after it builds and I copy the files to the web server and navigate to the page, I get the Could not load type '_Default' error.

    The only way I've been able to get around this is to use Inline Coding and I desperately want to get away from that!!!

    Any help is greatly appreciated.

    - Chris

    Wednesday, January 17, 2007 2:28 PM

All replies

  • The LIB stuff is only for C++. 

    It sounds like you are not copying all the necessary files to your web server.  Under the default v2 model for a web site you will copy all the files including the cs files to the web server.  The cs files will get compiled on the fly as needed by ASP.NET.  You can change the default settings through the project settings.  If you pre-compile your site then you'll need to be sure to copy the Bin\ directory and its files to the web server.

    Michael Taylor - 1/17/07
    http://p3net.mvps.org

     

    Wednesday, January 17, 2007 6:25 PM
  • Thanks for your reply. I think I've got it working now. I had to use the following asp compiler command:

    aspnet_compiler -p "D:\BuildManagerApp" -f -v -u "D:\Inetpub\wwwroot\BuildManager"

    Then, it works. I don't have to move any files (including bin) or any of that. It seems to compile a DLL and then marker files for my code and place that in the IIS directory.

    Wednesday, January 17, 2007 6:37 PM
  • Hi

    just a quick question,

    did you create your virtual directory by hand in iis or did you create it from within visual studio?

    I had a similar problem where the error i got was that asp.net could not find/create the global.asax type

    removing the virtual directory from iis and recreating if from within visual studio solved the issue

     

    Kind regards

     

    Sunday, January 21, 2007 10:48 PM
  • In the setup project you create for your application, you must specify that the Primary output from the Project goes into the "bin" folder (click on the "primary output" and browse to "bin" in the Folder property) , otherwise IIS can't find it. Once the dll is in the bin folder, IIS finds it and loads it.

    Tuesday, July 15, 2008 8:06 AM
  • This advise worked for me.  Thanks a lot! I got it working. :-)
    Wednesday, August 01, 2012 7:32 PM