C# 包含C++;托管dll引用在IIS上不起作用 我有一个在C语言中构建的Web服务,它使用托管C++ DLL。这在iisexpress中工作得非常好。但是当我尝试使用本地IIS时,它无法加载程序集

C# 包含C++;托管dll引用在IIS上不起作用 我有一个在C语言中构建的Web服务,它使用托管C++ DLL。这在iisexpress中工作得非常好。但是当我尝试使用本地IIS时,它无法加载程序集,c#,c++,web-services,iis,C#,C++,Web Services,Iis,WebService(C#)具有库的引用(C++dll)具有库的引用(C#dll) Web服务项目详细信息包含平台“.Net Framework v4.5.2”和运行时“v4.0.30319/x86” C++Dll详细信息具有平台“.Net Framework v4.0”和运行时“v4.0.30319/x86” IIS应用程序池详细信息的.Net Framework版本为“v4.0”,启用32位应用程序为“True”,托管管道模式为“Integrated” 错误消息是“无法加载文件或程序集'**

WebService(C#)具有库的引用(C++dll)具有库的引用(C#dll)

  • Web服务项目详细信息包含平台“.Net Framework v4.5.2”和运行时“v4.0.30319/x86”
  • C++Dll详细信息具有平台“.Net Framework v4.0”和运行时“v4.0.30319/x86”
  • IIS应用程序池详细信息的.Net Framework版本为“v4.0”,启用32位应用程序为“True”,托管管道模式为“Integrated”
  • 错误消息是“无法加载文件或程序集'**.DLL'或其依赖项之一。找不到指定的模块。”
  • 文件夹权限IUSR、IIS\u IUSR、IIS AppPool\这三种权限现在都具有完全访问权限
  • 下面是事件查看器日志。

    事件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>
    
    
    1310
    3.
    3.
    0x8000000000000
    42469
    应用
    迪格维贾伊
    3008
    发生配置错误。
    2017年4月28日12:48:06下午
    2017年4月28日上午7:18:06
    31199bc0e1114f6db1b89bebd5121a29
    1.
    1.
    0
    /LM/W3SVC/1/ROOT/Service-1-131378374852383402
    满满的
    /服务
    F:\Digvijay\Projects\Service\
    迪格维杰
    9496
    w3wp.exe
    IIS应用池\AS
    配置错误异常
    无法加载文件或程序集“LG.DLL”或其依赖项之一。找不到指定的模块。
    位于System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,Boolean starDirective)
    在System.Web.Configuration.CompliationSection.LoadAllAssembliesFromAppDomainBinDirectory()中
    在System.Web.Configuration.CompliationSection.LoadAssembly(AssemblyInfo ai)中
    位于System.Web.Compilation.BuildManager.GetReferencedAssemblys(CompilationSection compConfig)
    位于System.Web.Compilation.BuildManager.GetPrestartinitMethodsFromReferencedAssemblys()处
    在System.Web.Compilation.BuildManager.CallPreStartInitMethods(字符串preStartInitListPath、布尔值和isRefAssemblyLoaded)
    位于System.Web.Compilation.BuildManager.ExecuteRepapStart()处
    在System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager、IApplicationHost appHost appHost、IConfigMapPathFactory configMapPathFactory、HostingEnvironmentParameters hostingParameters、PolicyLevel PolicyLevel、Exception appDomainCreationException)
    无法加载文件或程序集“LG.DLL”或其依赖项之一。找不到指定的模块。
    位于System.Reflection.RuntimeAssembly.\n加载(AssemblyName文件名、字符串代码基、证据assemblySecurity、RuntimeAssembly位置提示、StackScrawlMark和stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean for Inspection、Boolean suppressSecurityChecks)
    位于System.Reflection.RuntimeAssembly.nLoad(AssemblyName文件名、字符串代码基、证据assemblySecurity、RuntimeAssemblyLocationHint、StackScrawlMark和stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean ForInspection、Boolean suppressSecurityChecks)
    位于System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackScrawMark&;stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean For Inspection,Boolean suppressSecurityChecks)
    在System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString、证据assemblySecurity、StackScrawMark&;stackMark、IntPtr pPrivHostBinder、用于内省的布尔值)
    在System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据assemblySecurity,StackScrawMark&;stackMark,用于内省的布尔值)
    在System.Reflection.Assembly.Load处(字符串assemblyString)
    位于System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,Boolean starDirective)
    http://localhost/Service/Service1.asmx
    /服务/服务1.asmx
    ::1
    假的
    IIS应用池\AS
    6.
    IIS应用池\AS
    假的
    位于System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,Boolean starDirective)
    在System.Web.Configuration.CompliationSection.LoadAllAssembliesFromAppDomainBinDirectory()中
    在System.Web.Configuration.CompliationSection.LoadAssembly(AssemblyInfo ai)中
    位于System.Web.Compilation.BuildManager.GetReferencedAssemblys(CompilationSection compConfig)
    位于System.Web.Compilation.BuildManager.GetPrestartinitMethodsFromReferencedAssemblys()处
    在System.Web.Compilation.BuildManager.CallPreStartInitMethods(字符串preStartInitListPath、布尔值和isRefAssemblyLoaded)
    位于System.Web.Compilation.BuildManager.ExecuteRepapStart()处
    在System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager、IApplicationHost appHost appHost、IConfigMapPathFactory configMapPathFactory、HostingEnvironmentParameters hostingParameters、PolicyLevel PolicyLevel、Exception appDomainCreationException)
    
    您的dll是否包含在deloyment服务器中。另一个选项可能不是你的C++ DLL。如何确保它是你的C++ DLL导致错误?另一个选项尝试将C++ DLL登记到Stase32目录。@ RDDS:DLL及其依赖项位于部署服务器上的WebService的bin文件夹内。我确信C++ DLL是根本原因,因为消息说“**dll”或它的一个依赖项没有被加载。@我已经尝试复制DLL到Stase32文件夹。但这并不奏效。