none
Problem to the line

All replies

  • Hi Hua Min,

    odd error. Try checking ...

    • The current User Account when calling this line
    • The permissions for that user on the .dll library containing this class (and the folder it resides in)

    Cheers,
    Fred


    There's no place like 127.0.0.1


    • Edited by FWN Thursday, February 12, 2015 8:52 AM
    Thursday, February 12, 2015 8:52 AM
  • Thanks.
    Can I have more details to permission check?

    Many Thanks & Best Regards, Hua Min

    Thursday, February 12, 2015 8:56 AM
  • Well, basic windows ACL (is the user allowed to read the file/folder? Does s/he have write access? Full control?).

    If it has only limited permissions (say: read only), try granting 'full control' privileges. Does the error still occur?


    There's no place like 127.0.0.1

    Thursday, February 12, 2015 9:01 AM
  • Hi FWN,
    What do you mean by "limited permission", as I can see now the relevant file is not Read-only below?


    Many Thanks & Best Regards, Hua Min


    • Edited by HuaMin Chen Thursday, February 12, 2015 9:41 AM
    Thursday, February 12, 2015 9:38 AM
  • Hi Hua Min,

    but you also obviously do not have full access to the file, as you would otherwise have another tab (Security):

    Properties

    The Read-only property you can see on the first tab merely prevents changing the file, but has nothing to do with Windows Access Control Lists (You could simply change the property).

    On the security tab you can check who may do what with the file. Try copying the demo project somewhere, where you can edit security settings (Your home drive probably). Then the tab will appear and you can check whether permissions are the problem with using the library.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Thursday, February 12, 2015 9:47 AM
  • Thanks.

    I copy the files to c:\ and re-do the same, but I still encounter the same problem to run that VBS line, originally shown in above.


    Many Thanks & Best Regards, Hua Min

    Thursday, February 12, 2015 10:30 AM
  • Hi Hua Min,

    Now that you have it where you can control permissions, have you ensured the process has full control permissions for the relevant file(s)?

    If that doesn't do the trick, I'm out of ideas, sorry.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Thursday, February 12, 2015 10:59 AM
  • 0x800A0046 often means the file is locked by another process.  It also can happen when a Net assembly is not properly signed or attempts to incorrectly access to incorrectly access another assembly during load.


    ¯\_(ツ)_/¯

    Thursday, February 12, 2015 2:21 PM
  • I do register it using these steps

    Start --> Run --> comexp.msc
    Navigate to Console Root - Componet Services - Computers - My Computer - COM+ Applications.
    Right click on 'COM+ Applications' and create New Application.
    Follow the wizard carefully. Hit Next. Create an Empty Application. Name it (mycomapp1 for instance). Make sure Server application radio box is selected. Pick the user account based on the requirement. Hit Next. Next. Finish.
    Now you have created a COM+ application named mycomapp1.
    Now, you need to add individual COM components to it.
    Expand mycomapp1 from the list. Right click on Components. Pick New Component. 
    Hit Next in the wizard. This next wizard screen is up to you. I would pick 'Install New components' if I haven’t run a regsvr32 or regasm on it. Pick the told or the dll (containing the tlb) file. And go ahead.. That’s how you do it.



    Many Thanks & Best Regards, Hua Min

    Friday, February 13, 2015 2:06 AM
  • This has absolutely nothing to do with scripting and it is not a solution to your previous issues.  Registering a COM Net Interop assembly with DCOM will not make it work.


    ¯\_(ツ)_/¯

    Friday, February 13, 2015 2:41 AM
  • I think I know what your problem is. When not trying to run the server from same folder as the EXE the server may fail to be found with an 80070002

    Use this registration command to get it to register for system wide access:

    regasm csdemo.dll /tlb:csdemo.tlb /codebase

    Notice that we added the "/codebase" parameter to the registry.  The TLB is necessary for use with VB6 and VBA.

    Be careful as pre Vista systems will likely have issues with the form.  The code should also be compiled under Net 2.0.


    ¯\_(ツ)_/¯

    Friday, February 13, 2015 3:44 AM

  • Be careful as pre Vista systems will likely have issues with the form.  The code should also be compiled under Net 2.0.


    ¯\_(ツ)_/¯

    Many thanks.
    Does it mean I have to change the version of Net and cannot use or point to anything like

    C:\Windows\Microsoft.NET\Framework\v4.0.30319

    ?


    Many Thanks & Best Regards, Hua Min


    • Edited by HuaMin Chen Friday, February 13, 2015 4:37 AM
    Friday, February 13, 2015 4:20 AM

  • Be careful as pre Vista systems will likely have issues with the form.  The code should also be compiled under Net 2.0.


    ¯\_(ツ)_/¯

    Many thanks.
    Does it mean I have to change the version of Net and cannot use or point to anything like

    C:\Windows\Microsoft.NET\Framework\v4.0.30319

    ?


    Many Thanks & Best Regards, Hua Min


    No but be sure all of the components are installed on the target.  By default CVS 2013 tries to install Linq and a few other bits of the framework. On re-Win7 systems this can be an issue.  Building for V2 is generally easier to deploy.

    I suggest that the first thing you need to do is try to understand what is happening at each step and why it matters.

    I was able to see the mistake because I went back over the issues trying to understand what could throw you and hundreds of others off when, from my experience, this is a very easy build.  I forget that I am used to defaulting the assembly.  This allows us to have different versions in different folders.  By adding /Codebase everybody shares the same assembly without storing it in the GAC.  For simple Interop we really don't want to use the GAC most of the time.  For Net assemblies for managed code then it is likely we will want to use the GAC.

    My list of steps hold but I will add this registration step to it so I and other don't forget it again.

    Recently I haven't built a lot of COM classes so I am getting rusty.  I have a couple of friends who build classes of all kinds regularly.  I should have "phoned a friend" and I would not have missed that.


    ¯\_(ツ)_/¯

    Friday, February 13, 2015 5:01 AM
  • By default CVS 2013 tries to install Linq and a few other bits of the framework. On re-Win7 systems this can be an issue.  Building for V2 is generally easier to deploy.



    ¯\_(ツ)_/¯

    The project is done by VS 2013. It seems we cannot change the version of

    Microsoft.NET\Framework\v4.0.30319

    to run regasm, right?


    Many Thanks & Best Regards, Hua Min


    • Edited by HuaMin Chen Friday, February 13, 2015 6:10 AM
    Friday, February 13, 2015 6:10 AM
  • I just changed the version back and forth 3 times with VS2013.

    I also dropped the TLB and just used the DLL and the reg file.  It works as expected in VBScript.

    Here is the reg file:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}]
    @="CSDemo.ComClass1"
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}\Implemented Categories]
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}\InprocServer32]
    @="mscoree.dll"
    "ThreadingModel"="Both"
    "Class"="CSDemo.ComClass1"
    "Assembly"="CSDemo, Version=3.0.0.0, Culture=neutral, PublicKeyToken=682b58d23b978bee"
    "RuntimeVersion"="v2.0.50727"
    "CodeBase"="file:///C:/scripts/CSDemo.DLL"
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}\InprocServer32\3.0.0.0]
    "Class"="CSDemo.ComClass1"
    "Assembly"="CSDemo, Version=3.0.0.0, Culture=neutral, PublicKeyToken=682b58d23b978bee"
    "RuntimeVersion"="v2.0.50727"
    "CodeBase"="file:///C:/scripts/CSDemo.DLL"
    
    [HKEY_CLASSES_ROOT\CLSID\{1A34A181-A9CA-3DAB-A730-59CF5A6345A2}\ProgId]
    @="CSDemo.ComClass1"
    
    

    Just be sure to change "codebase" to the correct folder and run the reg file.  It will register the DLL if it is built as I described.

    I just tested this on XP, WS2003, WS2008R2, Windows 7 and Windows 8.1.  It worked as required on all.

    I  have also added the "InstallShield Express Installer" project and created a installer to do all of this.

    All is done with the exact same version of VS2013 Express that you are using.


    ¯\_(ツ)_/¯

    Friday, February 13, 2015 6:18 AM
  • Really sorry JRV.

    Now the real question is, I work fine with .tlb file on one Win 7 machine and do get the mentioned problem on another win 7 machine. What can be the reason of the error?

    Many Thanks & Best Regards, Hua Min

    Friday, February 13, 2015 7:02 AM
  • I am sorry but I cannot fix your machines or teach you how to troubleshoot a computer system.  You will have to work that out by yourself.

    If your machines are as broken as I think they are I recomemnd just reinstallling everything from scratch according to some standard image.

    You have all of the information about the COM server.  THere is nothing more for me to do about that.

    Good luck.


    ¯\_(ツ)_/¯

    Friday, February 13, 2015 7:17 AM