开发者

Could not load type 'WebApp1._Default' in ASP.NET

When I am running my ASP.NET application I will get an error

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 m开发者_如何学Goodify your source file appropriately.

Parser Error Message: Could not load type 'WebApp1._Default'.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApp1._Default" %> Line 2:

Line 3:

Source File: /Default.aspx Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

How can I solve this problem?


Check your DLL is in the bin folder. (Not bin/debug...).


have you set your web app directory as application in IIS?

I have seen this error many times for different reasons.

  1. Check namespace
  2. dependent dll versions
  3. Visual studio clean and compile again.
  4. clean temp asp.net files "Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"


Did you rename the namespace or class name in the code-behind file? Open the code-behind file and verify that the namespace for the page is called WebApp1 and that the class is called _Default, or update the Inherits-attribute in the aspx page header to fit the code-behind.


Have you specified your _Default class is under the namespace WebApp1 in Default.aspx.cs file ?

Please check.


For me somehow the code-behind file got removed from the project. They showed up with a different icon in the solution explorer. I just had to expand the ASPX line to see the code behind and then right-click and add it to the project.


Please try under "Project Settings/Build" set OutputPath to "bin\" not "bin\debug". this was my problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜