首页 新闻 会员 周边

服务器“未能加载类型”

1
悬赏园豆:15 [已解决问题] 解决于 2012-06-14 17:54

以前的项目是vs2005之前的版本,现在转为vs2010版本的,编译通过,把.dll上传到服务器上再运行页面就出现这样的错误信息。

如图:

仔细检查了报错的.ascx页面以及.ascx.cs代码,命名空间和类名都没有错误,纠结啊;发现最后一行版本信息是:Microsoft .NET Framework 版本:1.1.4322.2443; ASP.NET 版本:1.1.4322.2460 ,而我现在编译的项目是4.0的,会不会是服务器上的编译器版本过低导致的呢?

还是有其他的原因?

请知道的朋友指点,谢谢!

(分不多了,见谅。)

问题补充:

出错的链接:http://www.jxjnjd.cn/Newspaper/LayoutList.aspx

NewsInfoList.ascx 源码:

View Code
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsInfoList.ascx.cs" Inherits="Smartsite.Newspaper.Web.Newspaper.Module.NewsInfoList" %>


<table width="98%" border="0" cellpadding="0" cellspacing="2" >
    <tr>
        <td></td>
    </tr>
    <asp:Repeater ID="repList" Runat="server">
        <ItemTemplate>
            <tr>
                <td style="border-bottom: #e7e7e7 1px solid; color:#F00; background-color:#FFF;">&nbsp;<img src="/Newspaper/images/dot.gif" width="4" height="7" /> <a href="NewsInfoList.aspx?ID=<%#DataBinder.Eval(Container.DataItem, "ID")%>&LayoutID=<%=LayoutID%>&PrintID=<%=PrintID%>&NewspaperID=<%=NewsPaperID%>"><%#DataBinder.Eval(Container.DataItem, "Title") %></a></td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>

NewsInfoList.ascx.cs 源码:

View Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace Smartsite.Newspaper.Web.Newspaper.Module
{
    public partial class NewsInfoList : System.Web.UI.UserControl
    {
        protected int NewsPaperID = 1;
        protected int PrintID = -1;
        protected int LayoutID = -1;

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["NewspaperID"] != null && Request.QueryString["NewspaperID"] != string.Empty)
            {
                try
                {
                    NewsPaperID = Convert.ToInt32(Request.QueryString["NewspaperID"]);
                }
                catch
                { }
            }
            if (Request.QueryString["PrintID"] != null && Request.QueryString["PrintID"] != string.Empty)
            {
                try
                {
                    PrintID = Convert.ToInt32(Request.QueryString["PrintID"]);
                }
                catch
                { }
            }
            if (Request.QueryString["LayoutID"] != null && Request.QueryString["LayoutID"] != string.Empty)
            {
                try
                {
                    LayoutID = Convert.ToInt32(Request.QueryString["LayoutID"]);
                }
                catch
                { }
            }
            if (PrintID == -1)
            {
                PrintID = Smartsite.Newspaper.BLL.Newspaper_Print.GetMaxID();
            }
            if (LayoutID == -1)
            {
                LayoutID = Smartsite.Newspaper.BLL.Newspaper_Layout.GetMaxID(PrintID);
            }
            IList al = Smartsite.Newspaper.BLL.Newspaper_NewsInfo.GetSearch(NewsPaperID, PrintID, LayoutID);
            repList.DataSource = al;
            repList.DataBind();
        }
    }
}
skybirdzw的主页 skybirdzw | 初学一级 | 园豆:3
提问于:2012-06-14 10:27
< >
分享
最佳答案
0

页面没编译出现的错误。当你转为vs2010,你得保证程序编译环境和运行环境都是4.0的

编译环境:

运行环境:

收获园豆:5
psforever | 菜鸟二级 |园豆:461 | 2012-06-14 13:16
其他回答(3)
0

你 发布的是4.0的,那么在服务器里配置站点的ASP.NET环境为4.0就好了。

收获园豆:5
无之无 | 园豆:5095 (大侠五级) | 2012-06-14 10:33
0

在IIS中将应用程序池的.NET Framework版本设置为4.0

收获园豆:5
dudu | 园豆:31003 (高人七级) | 2012-06-14 10:49
0

上面都回答了。。。

松鼠鱼 | 园豆:185 (初学一级) | 2012-06-14 14:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册