当前位置: 代码迷 >> ASP.NET >> 关于Could not load file or assembly 异常的有关问题
  详细解决方案

关于Could not load file or assembly 异常的有关问题

热度:2735   发布时间:2013-02-25 00:00:00.0
关于Could not load file or assembly 错误的问题


搞了一下午。实在找不到哪里有问题。

错误提示:
Server Error in '/' Application.
Could not load file or assembly 'WebSite.Core.AccessDAL' or one of its dependencies. 系统找不到指定的文件。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'WebSite.Core.AccessDAL' or one of its dependencies. 系统找不到指定的文件。

Source Error:

Line 13: {
Line 14: string className = path + ".SiteConfig";
Line 15: return (WebSite.Core.IDAL.ISiteConfig)Assembly.Load(path).CreateInstance(className);
Line 16: }
Line 17: }


Source File: E:\Web\ChnValve\Site.Core\DALFactory\DataAccess.cs Line: 15
上面:path值为:WebSite.Core.AccessDAL,下有一个siteconfig类
  这个文件确实存在的。。。就是不明白问题出在哪里了

问题补充:WebSite.Core是一个项目
文件夹:
BLL(业务逻辑层)
文件
namespace WebSite.Core.BLL
{
public class SiteConfig
{
private static readonly ISiteConfig dal=WebSite.Core.DALFactory.DataAccess.CreateConfig();
/// <summary>
/// 更新配置信息
/// </summary>
/// <param name="info"></param>
public void UpdateConfig(SiteConfigInfo info)
{
dal.UpdateConfig(info);
}

}
IDAL(数据访问层接口)
代码:
namespace WebSite.Core.IDAL
{
/// <summary>
/// 站点配置数据访问层接品
/// </summary>
public interface ISiteConfig
{
/// <summary>
/// 更新配置接口
/// </summary>
/// <param name="config"></param>
void UpdateConfig(SiteConfigInfo config);
/// <summary>
/// 获取配置接口
/// </summary>
/// <returns></returns>
SiteConfigInfo GetConfig(int id);
}
}
ACCESS数据访问层代码:

namespace WebSite.Core.AccessDAL
{
public class SiteConfig:ISiteConfig
{
DbDataReader reader;
/// <summary>
/// 更新系统配置
/// </summary>
/// <param name="info"></param>
public void UpdateConfig(SiteConfigInfo info)
{
SiteConfigInfo siteConfig = new SiteConfigInfo();
string sqlText = "update site_config set siteName=@siteName,siteDomain=@siteDomain,siteMail=@siteMail,copyRight=@copyRight,newsTemplate=@newsTemplate,newsCatalogTemplate=@newsCatalogTemplate,newsSavePath=@newsSavePath,newsPageSize=@newsPageSize,productTemplate=@productTemplate,productCatalogTemplate=@productCataLogTemplate,productSavePath=@productSavePath,productPageSize=@productPageSize,messagePageSize=@messagePageSize,imageSavePath=@imageSavePath";
OleDbParameter[] parms ={
new OleDbParameter(&qu


------解决方案--------------------------------------------------------
加载的程序集文件路径错误
断点调试下path的值.
而且Assembly.Load应该是文件,不是文件夹.
  相关解决方案