Link to home
Start Free TrialLog in
Avatar of TelDig
TelDigFlag for Canada

asked on

C++ (VC6.0) C# .NET 1.1, Cannot create instance, class not registred (network drive)

Our c++ application start but when it create the instance of the .net assembly, We get the errors message:  "Cannot create instance / class not registred".

- This only append when the application is run from a network drive
- The application run fine if we run a copy from a local drive.  (on the same machine of course)
- We have created a simple dialog .net 1.1 application and it run fine from the share (.net security configured)
- The com object is not signed/strong key and not registred (assembly cache...)
- The application is a VC6 .exe and call a .net 1.1 dll  (COM)

Our Diagnostic:
1- We guess that it work on a local drive because if the com is'nt found as registered, the system seek in the exe path but when we run it from network drive the system doesn't look in the exe.path
2- Currently the only solution we have found that might work is to sign the .net assembly and add it to the gac but this solution will force us to create an installer or registery process that we would like to avoid.

The Question:
Is our diagnostic are good and is there another solution to fix the issue?
Is there a way to force checking in the network path to find the COM object
//Code that load the assembly from our c++ app:
HRESULT hRes = eventSystem.CreateInstance(EventSystemRemotingWrapper::CLSID_MyEventSystem);
if(SUCCEEDED(hRes))
{
   m_bInstanceCreated = true;
}
 
//.Net assembly
   [ComVisible(true)]
   [Guid("7143BA98-5911-420c-9088-3FBA2CFDB76A")]
   [InterfaceType(ComInterfaceType.InterfaceIsDual)]
   public interface IMyEventSystem
   {
      [DispId(1)]
      void InitializeWrapper(string remoteObjectURI, string applicationName);
      [DispId(2)]
      bool OpenApplication(string pathTo, string argument);
      [DispId(3)]
      void SendEvent(string eventId, string eventInfo, string destination);
      [DispId(4)]
      void RegisterEvent(string eventId);
      [DispId(5)]
      void UnRegisterAllEvents();
      [DispId(6)]
      void UnRegisterEvent(string eventId);
      [DispId(7)]
      void SetEventSink(IEventSystemSink eventSink);
      [DispId(8)]
      int GetRemotingPortUsed();
      [DispId(9)]
      string GetTemporaryFolder(bool generateUniqueFilename, string extension);
      [DispId(10)]
      string SendEvent(string eventId, string eventInfo, string destination, bool waitForReturn);
      [DispId(11)]
      bool OpenApplicationSilent(string pathToCMS, string argument);
   }
   
   
   
   /// <summary>
   /// Summary description for CMSCommunication.
   /// </summary>
   [ComVisible(true)]
   [ClassInterface(ClassInterfaceType.None)]
   [ComSourceInterfaces(typeof(IEventSystemSink))]
   [Guid("A111315C-6E1A-422a-AC1A-00EE76FE5D95")]
   [ProgId("MyEvent.MyEventEventsystem")]
   public class TelDigEventSystem : ITelDigEventSystem
   {
      ...
   }

Open in new window

Avatar of PlatoConsultant
PlatoConsultant
Flag of United States of America image

in my view .net security configuration problem

Since network shares by default only get LocalIntranet permissions, it's relatively common to want to use CasPol to fully trust some shares that you control and know are safe.  However, CasPol syntax being what it is, the command to do this isn't immediately obvious.  If I wanted to trust everything on the share \\ShawnFa-Srv\Tools, the command:
Avatar of nsanga
nsanga

can you try registering the com object ( which is actually a .net dll) in the machine where you are running the application and try again.

Avatar of TelDig

ASKER

PlatoConsultant: if we have a simple dialog app in the share, this app work fine and CasPol was previously runned on that share.

Nsanga: Currently this dll cannot be registred, and neither put in assembly cache, my coworker tryed to give him a strong name and put it in the assembly but didn't work either.
when a application is executed from a share, the required things are copied into local machine and it is executed.

And so if the application is trying to instantiate a COM object, it will try to get the COM object details from registry which it could not get them as the COM object is not registered in local machine.

I would suggest you to first register the COM object in and then try.
Avatar of TelDig

ASKER

nsanga:
And how can we explain that it work if the content of the share is copied on the local drive? The COM object is not registred either!
We will try to modify the COM object to be registred on monday, but still found strange the current behavior.
Thanks

ASKER CERTIFIED SOLUTION
Avatar of TelDig
TelDig
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial