.net导入dll,问题,高手也无能为力!不看后悔!

来源:百度知道 编辑:UC知道 时间:2024/06/08 11:04:30
asp.net网站.
我添加引用: Windows Media Player
于是 Bin 目录下就有了 Interop.WMPLib.dll 文件.
代码:
WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
WMPLib.IWMPMedia me = player.newMedia(fileinfo.FullName);
float fTime = float.Parse(me.getItemInfo(me.getAttributeName(1)));

在本地vs2005中完美的运行.
可是我移动到远程服务器上后.(包扩 Bin )
会报:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'WMPLib' could not be found (are you missing a using directive or an assembly reference?)

拿掉那几行程序的话,服务器上也正常运行.

请高手指点: asp.net引用DLL的完美方案.

估计你本地机器上存在WMP.dll
而你的远程服务器上并没有WMP.dll

check一下服务器上 system32下有没有wmp.dll
如果存在还是不能用, 试下
regsvr32 msdxm.ocx
regsvr32 wmp.dll
regsvr32 wmpdxm.dll

进行DLL注册

服务器上面没有你想引用的DLL文件,自己手动添加一个就行.

我也是同意上面的想法,当你引用dll之后,可以右击,在属性里面可以看一下 复制本地 改成 true