Calling methods on a .net object from coldfusion

I am trying to instantiate and call methods on a .net object created from a dll from coldfusion. This works when I call methods with one or zero argument, but with an error -

System.MissingMethodException: Could not find a common method coldfusion2net.test.setvars

when I try to call a method with several arguments.

Here is my simple C # class:

namespace coldfusion2net { public class test { protected string myvar; protected string myvar2; public void setvars(string v, string v2) { myvar = v; myvar2 = v2; } public void setvar(string v) { myvar = v; } public string getvar(){ return myvar; } } } 

and here is my ColdFusion test:

 <cfset dll = ExpandPath('./coldfusion2net.dll')> <cfobject type=".NET" name="test" class="coldfusion2net.test" assembly="#dll#"> <cfset test.init()> <!--- object has been loaded ---> <cfdump var="#test#"> <!--- so far so good ---> <cfset test.setvar("foo")> <cfset s = test.getvar()> <cfoutput>#s#</cfoutput> <!--- wtf??? ---> <cfset test.setvars("foo","bar")> 

To compile the dll, I use visual studio 2010, oriented to the .net 3.5 runtime environment (which is what our servers have). I am using ColdFusion 8,0,0,176276 to try to load the DLL.

Has anyone else seen something like this? Am I doing something wrong? Is this a CF error?

I looked at an article about Adobe Live documents on .NET compatibility restrictions, but the closest I found is "ColdFusion cannot determine the correct data type conversion if the method has several signatures that have the same number of parameters and differ only in parameter data types " This does not seem to be a problem.

+7
source share
2 answers

Not sure if this will help, but ...

upgrading the .NET version to version 3.5 caused this problem because the ColdFusion.NET Integration Service has configured itself to use an earlier version of the .NET framework. Uninstall and Reinstall ColdFusion.NET Integration Service The problem is fixed in my case.

http://forums.adobe.com/thread/25391?tstart=0

+3
source

Just follow us. Moving to CF9 fixed this. I never understood how to make it work under 8.

0
source

All Articles