C++库文件无法从IIS识别

问题描述:

我有一些C++库(.dll)文件,必须在WCF webservice中使用。通常WCF只能理解位于C:\Program Files (x86)\Common Files\microsoft shared\DevServer\11.0的dll。我成功运行并通过代码调用dll。但在IIS中托管后,IIS无法找到dll文件,无法加载程序集。在IIS中放入dll文件的确切位置是什么?C++库文件无法从IIS识别

+1

为什么不把你的dll放在你的可执行文件的位置? – nvoigt 2013-04-29 05:38:16

+0

最初我只放在wcf应用程序文件夹中,但它无法加载。我在Google搜索了这个,它说WCF应用程序可以读取第三方dll,只有当位置是C:\ Program Files(x86)\ Common Files \ microsoft shared \ DevServer \ 11.0。所以只有我放。 – 2013-04-29 05:57:51

+0

请发布您的代码。你如何引用你的代码中的原生dll? – nvoigt 2013-04-29 07:11:53

不要从本地驱动器中的物理路径引用dll。如果你这样做,那么这些dll将在你的本地,只有服务将被移动到服务器。所以,在您的应用程序中放置一个文件夹,并将dll放在该文件夹中并引用它们。因此,在移动服务解决方案的同时,dll也将随解决方案一起移动。

If the dlls are owned by any other tools or applications then you need to install them in that server where you are planning to host the service. If you need only the dlls and they can work independently then you may copy the dlls as said above. 
+0

嗨Kirubha,我试过相同的东西,但从未加载过。 – 2013-04-29 06:10:10

+0

它返回的确切错误是什么? – 2013-04-29 06:12:23

+0

无法加载汇编文件传来 – 2013-04-29 06:28:08

该服务试图从GAC访问dll。请将dll添加到GAC。然后使用所需的dll更新配置文件如下

<compilation debug="true"> 
     <assemblies> 
     <add assembly="MyWcfAssembly, Version=1.0.0.0, Culture=neutral,  PublicKeyToken=AAAAAAAAAA"/> 
     </assembly> 
    </compilation> 
+0

请阅读这个问题。这是一个本地dll,您无法将其加载到GAC中。 – nvoigt 2013-04-29 07:11:12