开发者

ASP.NET C# - Source File Parse Error - Could not load inherits type file

开发者 https://www.devze.com 2023-02-15 21:57 出处:网络
How do I fix this error? I\'m running .NET Framew开发者_运维问答ork v4.0.30319 so the Framework shouldn\'t be an issue.I\'m not using any DLL files or bin directories. How do I setup the IIS/Virtual

How do I fix this error?

I'm running .NET Framew开发者_运维问答ork v4.0.30319 so the Framework shouldn't be an issue. I'm not using any DLL files or bin directories. How do I setup the IIS/Virtual Directory if I'm using Forms Authentication for the whole website using VS2010?

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 
    'ACAWebApplication.Pages.State_Carrier_Search'.
Source Error:

Line 1:  <%@ Page Title="ACA Web App - State Carrier Search" Language="C#"
             MasterPageFile="~/Pages/User.Master" AutoEventWireup="true"
             CodeBehind="State_Carrier_Search.aspx.cs"
             Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
Line 2:  <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" 
             runat="server">
Line 3:      <style type="text/css">
Source File: /Pages/State_Carrier_Search.aspx    Line: 1

The Codebehind for State_Carrier_Search.aspx.cs file:

namespace ACAWebApplication.Pages
{
    public partial class State_Carrier_Search : System.Web.UI.Page
    {
        protected void Page_LoadS(object sender, EventArgs e)

The code for State_Carrier_Search.aspx file is as follows:

<%@ Page Title="ACA Web App - State Carrier Search" Language="C#" MasterPageFile="~/Pages/User.Master" AutoEventWireup="true" CodeBehind="State_Carrier_Search.aspx.cs" Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">

thanks!


Thou shalt not name class and namespace the same

THIS is Your problem

namespace ACAWebApplication.Pages
{
    public partial class ACAWebApplication.Pages.State_Carrier_Search : System.Web.UI.Page
    {

The parser sees an ACAWebApplication.PAges namespace and sees ACAWebApplication.Pages class name. This is probably legal but it is very wrong

Drop the ACAWebApplication.PAges from the class name and it should work. Was it autogenerated or You have extracted the namespace from the class name. Either way change it

and read Eric lippert musings on it - whole series quite enlightening


Is the .NET version correctly set in IIS? This could be a .NET 2.0 app trying to run on the 1.0 framework.


Please refer to the Specify a .NET Framework Version for an Application Pool (IIS 7) article to learn more how to specify a .NET Framework version for an application pool.

0

精彩评论

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