Parser Error - Could not load type in IIS7.5 .NET 4 site

Hi Folks,

Just upgraded my website to Visual Studio 2010, changed the targeting to .NET4.

Built a deployment and installed it onto 2008R2 with .NET4 app pool and I'm getting the below error:

"Could not load type"

Any ideas? It runs fine on the dev machine.


Server Error in '/' Application.

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'website.main'.

Source Error:

Line 1:  <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="main.master.vb" Inherits="website.main" %>
Line 2:  
Line 3:  <?xml version="1.0" encoding="UTF-8"?>

Source File: /main.Master    Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Who is Participating?
plqConnect With a Mentor Author Commented:
Turned out that for some reason the deployment was placing the DLL website.dll into webfolder\bin\bin instead of webfolder\bin.

I presume this is a bug in the upgrade process of setup. Will investigate more now..
I think here is some issue:
CodeBehind="main.master.vb" Inherits="website.main" %>

Could you please past your .aspx and  code behind here to get into the issue..
plqAuthor Commented:
OK here's the top of default.aspx

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/main.Master" CodeBehind="default.aspx.vb" Inherits="website._default"
    title="Some Title" %>

<%@ MasterType virtualPath="~/main.Master" %>

<%@ register src="xxxx.ascx" tagname="xxbutton" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

And here's the top of main.Master

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="main.master.vb" Inherits="website.main" %>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">

<html xmlns="" xml:lang="en">
<head runat="server">
    <title>Page Title</title>
      <link href="main.css" rel="stylesheet" type="text/css" />

<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" /><!-- can't use text/xhtml because ie6 doesnt support it -->
<meta content="no-cache" http-equiv="Pragma" />
<meta name="keywords" content="xxxxxxxx" />

<script type="text/javascript" src="chat.js" ></script>

<body class="mainbody" onclick="try{bodyclick()} catch(e) {}" >

This has worked for years in .NET 2, and it works fine in .NET 4 on the dev machine, I get this error when its deployed out of the built msi on win2008r2. So I'm thinking its an IIS application or permissions issue


Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

in case its IIS issue, I preferred to try
Application pool > Managed pipeline mode: Integrated/Classic
plqAuthor Commented:
thanks I just tried that.

In iis 7.5 you don't get the option of "integrated/classic" - you can choose from integrated or classic but not both

When I switch to classic I get 404 page not found.
When I switch to integrated I get the original error message above
When I switch to a lower framework it raises an error about web.config entries

plqAuthor Commented:
BTW I've tried app pool and the app pool for the site itself. Both target 4.0 integrated. Both give the same error.

Both pools enable 32 bit and the app itself is compiled with 32 bit
yes that's what I mean you need you need to try either of these.

I also have faced the same kind of problem few days back.

I tried the classic mode and then do some fixation and in my case it works

if you are upgraded from 2.0 then you also try the classic mode then next find why its page not found.
AbdulQuddosConnect With a Mentor Commented:
move from IIS 6.0 to IIS7 gives to hard time to configure.
plqAuthor Commented:
Yes the above is the answer.  The .NET upgrade engine when going from 2.0 to 4.0 changes the location of the bin file seemingly at random.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.