2014-10-09 47 views
0

我想添加第三方C#DLL作为资源在我的Asp.net WebService项目与这些配置。无法加载文件或程序集“idrsnet15.dll”或其某个依赖项。指定的模块无法找到

C#DLL在运行时版本(4.0.30319)的x64环境中构建在dotnet framework 4中。
我们使用VS 2010框架版本4.0.30319 RTMRel;在ASP.Net webservice项目配置下,我们使用目标x64平台设置目标框架4。

我需要使用此DLL到我的Web服务应用程序,但通过IIS浏览时获取运行时异常。

----------------------------错误详情---------------- --------------------------------------------

Could not load file or assembly 'idrsnet15.dll' or one of its dependencies. The specified module could not be found. 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 'idrsnet15.dll' or one of its dependencies. The specified module could not be found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FileNotFoundException: Could not load file or assembly 'idrsnet15.dll' or one of its dependencies. The specified module could not be found.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +35
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +118

[ConfigurationErrorsException: Could not load file or assembly 'idrsnet15.dll' or one of its dependencies. The specified module could not be found.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11392147
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +484 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +127 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1087

[HttpException (0x80004005): Could not load file or assembly 'idrsnet15.dll' or one of its dependencies. The specified module could not be found.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 ----------------------------ERROR DETAIL------------------------------------------------------------

我们通过选择3.5框架创建Asp.net项目,然后在应用程序配置下设置目标框架4.0。

我可以见证TempAsp.net文件,包括此路径下组装和第三方DLL: C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 \临时ASP.NET文件\ myocrapp \ f4fd840d \ f71f8f0e \总成\ DL3 \ 1a6aa3d5 \ 00bb235d_957bcf01

+0

请考虑将帖子的名称更改为用户更容易的内容,如[如何提问](http://stackoverflow.com/help/how-to-ask)部分所述。 – 2014-10-09 10:20:54

回答

0

感谢Ashok的贡献。

我们通过配置'PATH'环境变量和IDRS un-managed dll(其他IDRS未管理的dll所在的路径)的值来解决这个异常,因为当IIS部署应用程序时,它只将临时dll部署到临时文件夹,但仍然需要加载成功的未受管理的第三方DLL。

+0

您是否在发布机器上设置了Path环境变量?我有本机C++ dll(非托管),发布时出现同样的错误。是否必须为应用程序发布dll才能找到它们,或者只需将它们上传到bin文件夹? – te7 2014-12-11 04:52:24

0

按我的理解,首先检查的你包括你的第三方DLL referene正常(不存在发布文件夹或虚拟目录) 第二件事,你提供的IIS以足够的访问权限访问你的第三方DLL,因此,你可以设置你的IIS虚拟目录以访问IIS用户账户。

您也可以使用Dependency Walker来了解您的第三方DLL(http://dependencywalker.com/)所需的相关程序集,并且所有必需的文件都存在于您的系统中,同时检查第三方dll的版本相关信息(如X64和x86是不同的,并且在某些情况下可能不会加载)。

相关问题