Class not found in the specified assembly list.

1 view
Skip to first unread message

hofar...@houseoffusion.com

unread,
Dec 24, 2010, 2:06:40 PM12/24/10
to ColdFusion Technical Talk

I run the following code and get an error.
<!---THIS WORKS--->
<cffunction name="Ping" returntype="string" output="false">
<cfargument name="host" type="string" required="yes">
<!--- Local variables --->
<cfset var pingClass="">
<cfset var pingReply="">
<!--- Get Ping class --->
<cfobject type=".NET" name="pingClass" class="System.Net.NetworkInformation.Ping">
<!--- Perform synchronous ping (using defaults) --->
<cfset pingReply=pingClass.Send(Arguments.host)>
<!--- Return result --->
<cfreturn pingReply.Get_Status().ToString()>
</cffunction>

<h3>Ping Test</h3>
<cfoutput>
127.0.0.1: #Ping("127.0.0.1")#<br>
www.adobe.com: #Ping("www.adobe.com")#<br>
</cfoutput>
<!---THIS GENERATES AN ERROR ON THE LAST LINE--->
<cfobject type=".NET"
name="HelloWorld"
class="HelloWorldProc"
assembly="C:\inetpub\wwwroot\DotNet\CFDotNetTest.dll" >

Here is the C# Code for the class:
using System;

public class HelloWorldProc
{
public HelloWorldProc()
{
}

public string HelloWorld()
{
return "HelloWorldProc:HelloWorld called and returns Hello world!";
}
}


Here is the page output:
Ping Test
127.0.0.1: Success
www.adobe.com: Success

Error Occurred While Processing Request
Class HelloWorldProc not found in the specified assembly list.
The assembly that contains the class must be provided to the assembly attribute.

The error occurred in C:\inetpub\wwwroot\DotNet\DotNetTest2.cfm: line 25

23 : name="HelloWorld"
24 : class="HelloWorldProc"
25 : assembly="C:\inetpub\wwwroot\DotNet\CFDotNetTest.dll" >
26 :
27 :

Here is the command line program:
I added the CFDotNetTest Project as a reference in the ConsoleApplication1 project so that the console app is aware of the dll.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HelloWorldProc h = new HelloWorldProc();
Console.WriteLine(h.HelloWorld());
string q = string.Empty;
Console.WriteLine("Type \"exit\" <Enter> to quit the sample.");
while (q.CompareTo("exit") != 0)
{
q = Console.ReadLine();
}
return;
}
}
}

Analysis:
1. The Ping test tells me that .Net Integration Services are running.
2. After uploading the files that were generated by the compiler to my CF server running CF 9, I run a program from the command line to test the assembly and it works.
3. I reinstalled Dot Net Integration Services.
4. The C# code was compiled under Dot Net 4.0. This may be the problem. I cannot verify that Dot Net Integration services supports Dot Net 4.0.

Any ideas or help would be greatly appreciated.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340267

Reply all
Reply to author
Forward
0 new messages