这是我的错误消息
解析器错误消息: 基类包含字段“iframeShim”,但其类型(System.Web.UI.HtmlControls.HtmlGenericControl)与控件的类型(System.Web.UI.HtmlControls.HtmlIframe)不兼容。
源错误:
Line 180: <iframe runat="server" id="iframeShim" frameborder="0" scrolling="no" style="position: absolute;
Line 181: display: block; z-index: 990; z-index: 990" src="~/blank.html"></iframe>
我正在使用.NET 4.0。
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.34249
设计师代码如下:
protected global::System.Web.UI.HtmlControls.HtmlGenericControl iframeShim;
我所做的搜索表明,当您升级到.NET 4.5并且服务器端变量的类型没有被正确更新(需要是HtmlIframe
,而不是HtmlGenericControl
)时,通常会出现此错误。此外,那些搜索结果中的解析器错误消息略有不同(在运行4.5时有意义)——他们的消息为:
...但它的类型(System.Web.UI.HtmlControls.HtmlIframe)与控件的类型(System.Web.UI.HtmlControls.HtmlGenericControl)不兼容。
我的web.config中的targetFramework是:
<compilation targetFramework="4.0">
所以,我不太确定这里发生了什么。有什么想法吗?请注意,我已经安装了VS2012,并最近不得不回到VS2010项目中做一些工作,然后这种情况开始发生。我立刻认为这是一个.NET版本问题,但在这个VS2010项目中所有东西仍然显示我正在使用.NET 4.0。