私は絶望的です。
フレームワーク 2.0 を使用した ASP.NET (Web フォーム) の小さなプロジェクトがあります。UserControl (ASCX) を少しメンテナンスしました。私の開発マシンは完璧に動作しますが、ファイルをサーバーにアップロードすると、次の例外がスローされます。
基本クラスにはフィールド 'MyControl_1' が含まれていますが、その型 (MyControl) はコントロールの型 (ASP.MyControl_ascx) と互換性がありません
私はほとんどすべてを試しました:
- http://chanmingman.wordpress.com/2011/09/07/the-base-class-includes-the-field-mycontrol_1-but-its-type-mycontrol-is-not-compatible-with-the-type-の-コントロール-asp-mycontrol_ascx/
- http://support.microsoft.com/kb/919284
これは本番サーバーでのみ発生します。名前空間でASCXをラップしようとしました:
コード:
namespace MyControl {
...
}
ASCX:
Inherits="MyControl.Control"
コントロールを使用する ASPX:
<%@Import Namespace="MyControl" %>
<%@ Register Src="Controls/SomeControl.ascx" TagName="SomeControl" TagPrefix="uc2" %>
<uc2:SomeControlID="Control1" runat="server" />
コンパイル モードは固定アセンブリの名前付けを使用していないため、変更できません。