-3

VS2010 で asp.net、C#4.0 アプリケーションを実行しています。次のコンパイル エラーが発生します。

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Source Error:

Line 1:  using System;

Line 2:  using System.Collections.Generic;

Line 3:  using System.Linq;

マイページの属性は:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
    EnableEventValidation="false" Inherits="jsPlumb_jsPlumb_Default2" %>

私のC#コードビハインドクラス:

  namespace CompanyDisplay.jsPlumb.jsPlumb.jsPlumb
  {
        public  class jsPlumb_jsPlumb_Default2 : System.Web.UI.Page
        {
    }
}

いくつかの Web サービス アプリケーションを実行するために名前空間を提示したい。

4

3 に答える 3

0

このエラーは、分離コードクラス名がaspxページの「inherits」属性と一致しない場合に表示されます。多分あなたは何かの名前を変更しようとしましたか?

さらに、新しいページを表示しようとしたがソースをコンパイルしなかったときにこのエラーが発生したため、aspxが存在していても、対応する分離コードクラスと戦うことはできません。

編集:

命名規則が完全に台無しになっているので、クラス名を正しく一致させるのに問題があるのは当然です。

申し訳ありませんが、これはばかげています!

inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"

規則を修正すると、次のようなソースファイルがあることに気付くかもしれません。

CodeBehind="Default.aspx.cs" Inherits="MyNamespace.jsPlumb.Default"

jsPlumb.jsPlumb.jsPlumbのようにしないでください....それはただの悪夢です!

于 2012-05-26T10:36:14.960 に答える
0
于 2012-05-26T10:32:44.773 に答える
0

私は答えを得ました; 継承属性を次のように指定する必要があります。

inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"

于 2012-05-26T10:49:11.303 に答える