473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

An error occured by ActiveXObject and show Automation server can't create the object

i have wrote a COM by C#.Net for transfered by a client from web, which i implement by using Javascript...
i have try all the sovle all i can search from the web,such as :to make the IE security low...
i also can't solve my problem...now, i need help...it trouble me have 4 days...
my problem is : when it run on the "var obj = new ActiveXObject("Wrox.ProCSharp.COMInterop.Server.Do tnetComponent");"//Wrox.ProCSharp.COMInterop.Server.DotnetComponent is the COM name which i writed.

there is all my code...thanks for your concerned...
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.     <HEAD>
  3.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4.         <TITLE>Test My DLL </TITLE>
  5.  
  6.  
  7.  
  8.         <script language="JavaScript" type="text/javascript">
  9.         try{
  10.         var obj = new ActiveXObject("Wrox.ProCSharp.COMInterop.Server.DotnetComponent");
  11.         }
  12.         catch(e)
  13.         {
  14.             alert(e.message);    
  15.         }
  16.  
  17.         function init()
  18.         {
  19.             TestDLL();
  20.         }
  21.  
  22.         function TestDLL()
  23.           {  
  24.                 try{
  25.  
  26.                   var sum = 0; 
  27.                 sum = obj.add(23, 60);
  28.                 alert("sum is "+sum);  
  29.                 }
  30.                 catch(e)
  31.                 {
  32.                     alert(e.message);
  33.                 }
  34.           }
  35.  
  36. </script>
  37.  
  38. <OBJECT id = "DotNetComponent" name = "DotNetComponent" classid = "{C54686D5-B2A9-4C98-A744-0F84DC4A0757}" codebase = "DotNetComponent.dll#Wrox.ProCSharp.COMInterop.Server.DotnetComponent"> </OBJECT>    
  39. <META content="text/html; charset=gb2312" http-equiv=Content-Type>
  40.  
  41.     </HEAD>
  42.     <BODY id=tx_config onload=javascript:init()>
  43.  
  44.  
  45.     <input name="Submit4" type="button" style="width:200px" onClick="javascript:TestDLL();return false;" value="Test DLL Now!!!">
  46.  
  47.  
  48. </BODY>
  49. </HTML>
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. namespace Wrox.ProCSharp.COMInterop.Server
  6. {
  7.     [InterfaceType(ComInterfaceType.InterfaceIsDual)]
  8.     public interface IWelcome
  9.     {
  10.         [DispId(60040)]   string Greeting(string name);
  11.     }
  12.  
  13.     [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  14.     public interface IMath
  15.     {
  16.         int Add(int val1, int val2);
  17.         int Sub(int val1, int val2);
  18.     }
  19.  
  20.     [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
  21.     public interface IMathEvents
  22.     {
  23.         [DispId(46200)] void CalculationCompleted();
  24.     }
  25.  
  26.     [ComVisible(false)]
  27.     public delegate void CalculationCompletedDelegate();
  28.  
  29.  
  30.     [ClassInterface(ClassInterfaceType.None)]
  31.     [ProgId("Wrox.DotnetComponent")]
  32.     [Guid("C54686D5-B2A9-4c98-A744-0F84DC4A0757")]
  33.     [ComSourceInterfaces(typeof(IMathEvents))]
  34.     public class DotnetComponent:IWelcome,IMath
  35.     {
  36.         public DotnetComponent()
  37.         {
  38.  
  39.         }
  40.  
  41.         public string Greeting(string name)
  42.         {
  43.             return "Hello" + name;
  44.         }
  45.  
  46.         public event CalculationCompletedDelegate CalculationCompleted;
  47.  
  48.         public int Add(int val1, int val2)
  49.         {
  50.            int result = val1 + val2;
  51.             if(CalculationCompleted != null)
  52.                 CalculationCompleted();
  53.             return result;
  54.         }
  55.  
  56.         public int Sub(int val1, int val2)
  57.         {
  58.  
  59.             int result =  val1 - val2;
  60.             if(CalculationCompleted != null)
  61.                 CalculationCompleted();
  62.             return result;
  63.         }
  64.  
  65.  
  66.  
  67.     }
  68.  
  69.  
  70.  
  71.  
  72.  
  73. }
  74.  
Sep 16 '10 #1
0 1044

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Raed Sawalha | last post by:
I successfully created ASP.NET Web Application, but when write click the problem and click Add new Item and choose any item (like class webform...etc) then click OK error message is generated...
1
by: Ueslei R. Valentini | last post by:
Hi! Does anyone figured out this error when trying to create a new page in a web project under Windows2003, using Visual Studio .Net 2003? "Automation server can't create object " HSH Ueslei
4
by: Tim | last post by:
The following javascript has been working just fine for the last 5 months. Now, for no apparent reason, the following error occurs when the script is run. "Automation server can't create object"...
1
by: fci_is | last post by:
hi i make this code in HTML page <script language=javascript> function LoadObject() { var wdApp = new ActiveXObject("InternetExplorer.Application"); wdApp.visible=true;...
2
by: lulu | last post by:
Hello! I am getting the error 'automation server can't create object ' when trying to create new IE instance in jscript : var ie = new ActiveXObject('InternetExplorer.Application'); ie.visible...
1
by: nehacredo | last post by:
hi all.. when im copying a PDF file content to a textarea using JavaScript i am getting an error "Automation Server Can't creat object" why it is coming... im copying my code here. <html>...
3
by: rcnairc2k | last post by:
while i am using File system object in Java script. i got this error " Automation server can't create object" my code is for transfer a file from users system to host location.. Working in ASP.NET...
5
by: vipinkrajput | last post by:
Hi, i m using javascript for writing in a file,the code is correctly working with IE 6.0, i m getting the error like "Automation server can't create object" in IE 7.0 while using...
1
by: lovetobesumit | last post by:
I use file system object to open a html file in a text area. when i write the code like, fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.OpenTextFile(file,...
0
by: dim505 | last post by:
hi friends, I'm new to this forum. I have created and build a dll but at first it was getting the error"Automation server can't create object" after a lot of head ache,I got the script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.