致命错误:未捕获的异常'com_exception',消息'无法实例化 [英] Fatal error: uncaught exception 'com_exception' with message 'failed to instantiate
问题描述
我正在使用Windows 8.1,PHP版本5.6.19和Visual Studio 2015.我创建了一个dll文件并使用命令成功注册了
C:\\ \\ Program Program(x86)\ Myoftoft SDKs \ Windows \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\我可以通过这条路径看到我的d:C:\ Windows \ microsoft.NET \assembly \ GAC_MSIL。
但是当我运行我的php文件时,得到此错误:
致命错误:未捕获异常'com_exception',消息'无法实例化.Net对象[CreateInstance] [0x80070002]系统找不到指定的文件。 '在C:\ xampp \htdocs \PhpProject2 \ index.php:23堆栈跟踪:#0 C:\ xampp \\\ htdocs \PhpProject2 \ index.php(23):dotnet-> dotnet ('ClassLibrary1,V ...','ClassLibrary1.C ......')#23 {main}抛出C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\ b $ b
似乎php文件无法在我的系统中找到dll。你能告诉我如何解决这个问题吗?
我尝试过的事情:
这是我的PhP代码:
$ class1 =新的DOTNET(ClassLibrary1,
。版本= 1.0 .0.0,
。文化=中立,
。PublicKeyToken = 8fede19312ec6e8b
,ClassLibrary1.Class1); < br $>
echo($ class1-> SayHello());
class1 = new DOTNET( ClassLibrary1,
。Version = 1.0.0.0,
。Culture = neutral,
。PublicKeyToken = 8fede19312ec6e8b
,ClassLibrary1.Class1);
echo(
class1-> SayHello( ));
I am using windows 8.1, PHP Version 5.6.19 and Visual Studio 2015. I created a dll file and registered it successfully using the command
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe
Now i can see my dll through this path C:\Windows\Microsoft.NET\assembly\GAC_MSIL.
But when I am running my php file, getting this error:
Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified. ' in C:\xampp\htdocs\PhpProject2\index.php:23 Stack trace: #0 C:\xampp\htdocs\PhpProject2\index.php(23): dotnet->dotnet('ClassLibrary1,V...', 'ClassLibrary1.C...') #1 {main} thrown in C:\xampp\htdocs\PhpProject2\index.php on line 23
It seems that the php file cannot locate the dll in my system. Would you please tell me how to solve the issue?
What I have tried:
here is my PhP code:
$class1 = new DOTNET("ClassLibrary1,"
."Version=1.0.0.0,"
."Culture=neutral,"
."PublicKeyToken=8fede19312ec6e8b"
,"ClassLibrary1.Class1");
echo($class1->SayHello());
class1 = new DOTNET("ClassLibrary1,"
."Version=1.0.0.0,"
."Culture=neutral,"
."PublicKeyToken=8fede19312ec6e8b"
,"ClassLibrary1.Class1");
echo(
class1->SayHello());
这篇关于致命错误:未捕获的异常'com_exception',消息'无法实例化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!