日期:2014-05-20  浏览次数:20794 次

未能加载文件或程序集。“——62.SQLServer或它的依赖项,系统找不到文件”
C# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace _62.DALFactory
{
    public class News
    {
        public static _62.IDAL.INews Create()
        {
            string path = System.Configuration.ConfigurationManager.AppSettings["WebDAL"].ToString();
            string classname = path + ".News";

            return (_62.IDAL.INews)Assembly.Load(path).CreateInstance(classname);
        }
    }
}



未能加载文件或程序集。“——62.SQLServer或它的依赖项,系统找不到文件”

------解决方案--------------------
return (_62.IDAL.INews)Assembly.Load(path).CreateInstance(classname);

调试一下: path的值是否正确

------解决方案--------------------
试试:把*.dll 布署到web程序的bin目录下。
------解决方案--------------------
Web项目下的Bin,是否缺少生成的DAL.dll
打开DAL项目的属性,检查AssemblyName

------解决方案--------------------
<add key="DAL" value="IMS.DAL"/>
string path = System.Configuration.ConfigurationManager.AppSettings["DAL"].ToString();
string classname = path + ".News";
return (INews)Assembly.Load(path).CreateInstance(classname);
没问题