最近学习petshop仿照工厂模式做了一个程序怎么都是找不到这个程序集
我也看了sqlserverdal这个属性了。确实和web.config的名称一样。现在我也不明白是什么问题了
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.IO.FileNotFoundException: 未能加载文件或程序集“bjdream.SQLServerDAL”或它的某一个依赖项。系统找不到指定的文件。源错误:
行 132: {
行 133: string className = path + ".webpicmanager";
行 134: return (Iwebpicmanager)Assembly.Load(path).CreateInstance(className);
行 135: }
行 136: #endregion
我也看了sqlserverdal这个属性了。确实和web.config的名称一样。现在我也不明白是什么问题了
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.IO.FileNotFoundException: 未能加载文件或程序集“bjdream.SQLServerDAL”或它的某一个依赖项。系统找不到指定的文件。源错误:
行 132: {
行 133: string className = path + ".webpicmanager";
行 134: return (Iwebpicmanager)Assembly.Load(path).CreateInstance(className);
行 135: }
行 136: #endregion
解决方案 »
- 按周和月统计登陆次数
- for循环检测隐藏问题
- 服务器错误 用户登陆失败
- asp.net 自定义控件ascx刷新问题
- 关于cookie的问题???????
- GAC问题
- 关于asp.net 官方论坛中FormsAuthentication.SetAuthCookie的问题。
- 如何在aspx里面引用导入的ascx的对象。
- ●●●要求DataGrid控件能一次修改多个记录,并在修改后完成特殊的操作!如内!●●●
- 未能加载文件或程序集“FredCK.FCKeditorV2, Version=2.2.2106.29421,...
- 一个关于arraylist的问题
- the status code returned from the server was: 12029
--------------------------------------------------------------------------------未能加载文件或程序集“SQLServerDAL.webpicmanager”或它的某一个依赖项。系统找不到指定的文件。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.IO.FileNotFoundException: 未能加载文件或程序集“SQLServerDAL.webpicmanager”或它的某一个依赖项。系统找不到指定的文件。源错误:
行 132: {
行 133: string className = path + ".webpicmanager";
行 134: return (Iwebpicmanager)Assembly.Load(path).CreateInstance(className);
行 135: }
行 136: #endregion
源文件: C:\Documents and Settings\Administrator\桌面\Bjdream\DALFactory\DataAccess.cs 行: 134 程序集加载跟踪: 下列信息有助于确定程序集“SQLServerDAL.webpicmanager”无法加载的原因。
警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。 堆栈跟踪:
[FileNotFoundException: 未能加载文件或程序集“SQLServerDAL.webpicmanager”或它的某一个依赖项。系统找不到指定的文件。]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +50
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
DALFactory.DataAccess.Createwebpicmanager() in C:\Documents and Settings\Administrator\桌面\Bjdream\DALFactory\DataAccess.cs:134
BLL.webpicmanager..cctor() in C:\Documents and Settings\Administrator\桌面\Bjdream\BLL\webpicmanager.cs:18[TypeInitializationException: “BLL.webpicmanager”的类型初始值设定项引发异常。]
BLL.webpicmanager..ctor() +0
bjdream_manager_main_webadd_flash..ctor() in c:\Documents and Settings\Administrator\桌面\Bjdream\Website\bjdream_manager\main\webadd_flash.aspx.cs:18
ASP.bjdream_manager_main_webadd_flash_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website\cc4a0e4e\2871a021\App_Web_ywqzqgl3.4.cs:0
__ASP.FastObjectFactory_app_web_ywqzqgl3.Create_ASP_bjdream_manager_main_webadd_flash_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website\cc4a0e4e\2871a021\App_Web_ywqzqgl3.98.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +58
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +113
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +32
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +62
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +294
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +147
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +152
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1882; ASP.NET 版本:2.0.50727.1879
类文件中添加对命名空间的引用:using .....
找不到这个文件吧
你在web.config中
<add key="WebDAL" value="SQLServerDAL"/>
中却配置成SQLServerDAL;
打开你生成的SQLServerDAL,如果生成的是SQLServerDAL.dll,则上面的配置就没错,如果是bjdream.SQLServerDAL,上面的配置就错了
通过反射生成
private static object GetInstance(string CacheKey)
{
object objType = DataCache.GetCache(CacheKey);
if (objType == null)
{
try
{
objType = Assembly.Load(DALFactory._path).CreateInstance(CacheKey);
DataCache.SetCache(CacheKey, objType);
}
catch (Exception ex)
{
throw ex;
}
}
return objType;
}
public static IAnnounceDAL AnnounceDALInstance()
{
string CacheKey = DALFactory._path + ".AnnounceDAL";
object objType = DALFactory.GetInstance(CacheKey);
return (IAnnounceDAL)objType;
}
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
这个两个程序集去连接数据库
我觉得是不是出在这个两个程序上面啊?
这个从缓存读取我没有用到啊
我的是数据库连接用的是这个俩个程序集
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
web.config配置是:
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<dataConfiguration defaultDatabase= "SQLConnString " />
<appSettings>
<add key="WebDAL" value="SQLServerDAL"/>
</appSettings>
SQLServerDAL的属性名称我已经核对过了。和这个value的值是一样的
反射生成的方法:
public static Iwebpicmanager Createwebpicmanager()
{
string className = path + ".webpicmanager";
return (Iwebpicmanager)Assembly.Load(path).CreateInstance(className);
}
这是报的错误:
System.IO.FileNotFoundException: 未能加载文件或程序集“SQLServerDAL”或它的某一个依赖项。系统找不到指定的文件
跟踪信息如下:
程序集加载跟踪: 下列信息有助于确定程序集“SQLServerDAL”无法加载的原因。
警告: 程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。
注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。 堆栈跟踪:
[FileNotFoundException: 未能加载文件或程序集“SQLServerDAL”或它的某一个依赖项。系统找不到指定的文件。]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +50
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
System.Reflection.Assembly.Load(String assemblyString) +25
DALFactory.DataAccess.Createwebpicmanager() in C:\Documents and Settings\Administrator\桌面\Bjdream\DALFactory\DataAccess.cs:134
BLL.webpicmanager..cctor() in C:\Documents and Settings\Administrator\桌面\Bjdream\BLL\webpicmanager.cs:18[TypeInitializationException: “BLL.webpicmanager”的类型初始值设定项引发异常。]
BLL.webpicmanager..ctor() +0
bjdream_manager_main_webadd_flash..ctor() in c:\Documents and Settings\Administrator\桌面\Bjdream\Website\bjdream_manager\main\webadd_flash.aspx.cs:18
ASP.bjdream_manager_main_webadd_flash_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website\cc4a0e4e\2871a021\App_Web_mkej10ro.24.cs:0
__ASP.FastObjectFactory_app_web_mkej10ro.Create_ASP_bjdream_manager_main_webadd_flash_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website\cc4a0e4e\2871a021\App_Web_mkej10ro.98.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +58
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +113
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +32
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +62
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +294
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +147
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +152
希望能解决问题