从运行ColdFusion的.NET的DLLColdFusion、NET、DLL

2023-09-05 04:28:00 作者:独恋ヽ花尽散

我已经做了很多的搜索,也做,我已经找到了建议,但似乎没有奏效。最简单的C#的DLL文件,它返回一个数字:

 命名空间的TestClass
{
    公共类的Class1
    {
        公众诠释测试仪()
        {
            返回5;
        }
    }
}
 

在ColdFusion的code:

 < cfobject类型= NAME =MYDLL级=TestClass.Class1集结号=D:/path/to/dll/TestClass.dll网。&GT ;
 

我所有的努力都使我这个错误:

 类TestClass.Class12不在指定的组件列表中找到。
包含类的组件必须提供到装配属性。
 
Of Cold Fusion and Light Mass

我不知道问题出在哪里可以。任何帮助将大大AP preciated。

此外,code以下不工作:

 <。NETcfobject类型= NAME =seClass级=统环境>
< CFOUTPUT>#seClass.Get_Version()的ToString()#< / CFOUTPUT>
 

解决方案

这可能是一些棘手的试验和错误,以得到这个权利。但错误是指在汇编列表,也可能是JNBDOtNetSide.exe.config文件,该文件可以在JNBridge的目录中(取决于你如何设置服务器的路径,该目录而异)的一部分。

在文件中,你会发现下注释掉的XML节点< jnibridge> ,看起来像这样

 <! - 
    < assemblyList>
        <装配文件=路径先.NET端组件/>
        <装配文件=路径第二.NET端组件/>
    < / assemblyList>
     - >
 

您可以尝试把你的路径存在并重新启动该服务。其他的事情尝试 - 添加程序集到全局缓存和(最后)删除被instnatiated在WEB-INF的核心代理jar文件。如果你搜索我的博客(coldfusionmuse.com)的.NET集成,你会发现,可能让你开始一些额外的线索。很多的试验和错误在这里,虽然在我的经验。

I've done many searches and have done the suggestions that I've found, but nothing seems to be working. The most simple C# DLL file that returns a number:

namespace TestClass
{
    public class Class1
    {
        public int tester()
        {
            return 5;
        }
    }
}

the coldfusion code:

<cfobject type=".NET" name="myDLL" class="TestClass.Class1" assembly="d:/path/to/dll/TestClass.dll">

All of my attempts have lead me to this error:

Class TestClass.Class12 not found in the specified assembly list. 
The assembly that contains the class must be provided to the assembly attribute. 

I have no clue where the problem could be. Any help would be greatly appreciated.

Also, the code below does work:

<cfobject type=".NET" name="seClass" class="System.Environment">
<cfoutput>#seClass.Get_Version().ToString()#</cfoutput>

解决方案

This can be some tricky trial and error to get this right. But the error is referring to an assembly list that is probably a part of the JNBDOtNetSide.exe.config file which can be found in the jnbridge directory (the path to this directory varies depending on how you set up your server).

Within the file you will find a commented out xml node under <jnibridge> that looks like this.

   <!--
    <assemblyList>
        <assembly file="path to first .NET-side assembly"/>
        <assembly file="path to second .NET-side assembly"/>
    </assemblyList>
    -->

You can try putting your path there and restarting the service. Other things to try - adding your assembly to the global cache and (last resort) deleting the core proxy jar file that is instnatiated in Web-INF. If you search my blog (coldfusionmuse.com) for ".NET Integration" you will find some additional clues that might get you started. Lot's of trial and error here though in my experience.