【发布时间】:2015-02-16 15:44:14
【问题描述】:
我将创建 .net dll 文件的对象以访问其功能,但它会产生错误。我还重新安装了 ColdFusion 10 .NET 集成服务安装程序,但无法解决。 这是我的代码。
<cftry>
<cfscript>
variables.dotNetObject = createObject("dotnet", "Calculator.Calculator", "D:/Calculator.dll").init();
WriteDump(variables.dotNetObject);
</cfscript>
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
这是 Calculator.dll 文件。
using System;
namespace Calculator
{
public class Calculator
{
public int addition(int a, int b)
{
return a + b;
}
}
}
这是我收到的错误消息
Message: Calculator.Calculator
ID: CF_CFPAGE
Line: 3
Type: java.lang.ClassNotFoundException
请帮忙。提前致谢。
【问题讨论】:
-
完整的错误信息是什么?你能成功加载 any .net 对象吗?试试the example at the bottom of the documentation。它使用核心类,而不是自定义 dll 文件。
标签: .net object dll coldfusion