包含c ++托管dll引用的C#Web服务在IIS上不起作用

时间:2017-04-27 05:48:03

标签: c# c++ web-services iis

我有一个用C#构建的Web服务,它使用托管的C ++ dll。这在IIS Express中完全正常。但是当我尝试使用本地IIS时,它无法加载程序集。

WebService(C#)引用了Library(C ++ dll)引用了Library(C#dll)。

  1. WebService项目详情拥有平台“.Net Framework v4.5.2”和运行时“v4.0.30319 / x86”
  2. C ++ Dll详细信息拥有平台“.Net Framework v4.0”和运行时“v4.0.30319 / x86”
  3. IIS应用程序池详细信息具有.Net Framework版本“v4.0”,将32位应用程序设置为“True”,将管道管道模式设置为“集成”。
  4. 错误消息是“无法加载文件或程序集”**。DLL'或其依赖项之一。找不到指定的模块。“
  5. 文件夹权限 IUSR,IIS_IUSRS,IIS AppPool \所有这三者现在都可以完全访问。
  6. 以下是事件查看器日志。

    事件Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="ASP.NET 4.0.30319.0" />
        <EventID Qualifiers="32768">1310</EventID>
        <Level>3</Level>
        <Task>3</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2017-04-28T07:18:06.000000000Z" />
        <EventRecordID>42469</EventRecordID>
        <Channel>Application</Channel>
        <Computer>Digvijay</Computer>
        <Security />
      </System>
      <EventData>
        <Data>3008</Data>
        <Data>A configuration error has occurred.</Data>
        <Data>4/28/2017 12:48:06 PM</Data>
        <Data>4/28/2017 7:18:06 AM</Data>
        <Data>31199bc0e1114f6db1b89bebd5121a29</Data>
        <Data>1</Data>
        <Data>1</Data>
        <Data>0</Data>
        <Data>/LM/W3SVC/1/ROOT/Service-1-131378374852383402</Data>
        <Data>Full</Data>
        <Data>/Service</Data>
        <Data>F:\Digvijay\Projects\Service\</Data>
        <Data>DIGVIJAY</Data>
        <Data>
        </Data>
        <Data>9496</Data>
        <Data>w3wp.exe</Data>
        <Data>IIS APPPOOL\AS</Data>
        <Data>ConfigurationErrorsException</Data>
        <Data>Could not load file or assembly 'LG.DLL' or one of its dependencies. The specified module could not be found.
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
       at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
       at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
       at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
       at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
       at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean&amp; isRefAssemblyLoaded)
       at System.Web.Compilation.BuildManager.ExecutePreAppStart()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    
    Could not load file or assembly 'LG.DLL' or one of its dependencies. The specified module could not be found.
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
       at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection)
       at System.Reflection.Assembly.Load(String assemblyString)
       at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
    
    </Data>
        <Data>http://localhost/Service/Service1.asmx</Data>
        <Data>/Service/Service1.asmx</Data>
        <Data>::1</Data>
        <Data>
        </Data>
        <Data>False</Data>
        <Data>
        </Data>
        <Data>IIS APPPOOL\AS</Data>
        <Data>6</Data>
        <Data>IIS APPPOOL\AS</Data>
        <Data>False</Data>
        <Data>   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
       at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
       at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
       at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
       at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
       at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean&amp; isRefAssemblyLoaded)
       at System.Web.Compilation.BuildManager.ExecutePreAppStart()
       at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
    </Data>
      </EventData>
    </Event>
    

0 个答案:

没有答案