Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / May 2006

Tip: Looking for answers? Try searching our database.

.NET interop and using remoting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Josh Bernard - 15 May 2006 19:14 GMT
Im having some problems getting my .net assembly to work correctly through a
CCW. In the initial release I did not have to use remoting and it was very
simple to get it working under VB6. Now I must use remoting to access a data
provider and Im seeing weird things happen.

I developed and tested my class in .NET 1.1 sp1 and it works perfect. I
registered the assembly for interop and it builds just fine with VB6 except
when I make a call to a method it doesnt seem to process as I get nothing
returned. If I stop the vb6 app and re run it I get a remoting error:

"Remoting configuration failed with the exception
'System.Runtime.Remoting.RemotingException: The remoting application name,
'Client', had already been set.   at System.Runtime.Remoting"

I never got this message when I was testing the class in .NET.

Are there any problems with remoting and doing COM interop? I dont think
that there would be as my class is being executed by the CLR.

If anyone knows how to debug interop I would really appreciate it!

Thanks, Josh
Federico - 24 May 2006 11:43 GMT
I've too problems with a remoting component COM exposed. Works sucessfully
.NET called, but COM invocation raises  -2146233077 (8013150b)  error .
I have debuged remarking parts of the remoting component code, and the error
raise when I try to register the chanel with
RemotingConfiguracion.Configure.

> Im having some problems getting my .net assembly to work correctly through
> a
[quoted text clipped - 21 lines]
>
> Thanks, Josh
Josh Bernard - 24 May 2006 13:39 GMT
Well I have found the answers to my problem and it was actually 2 problems I
found out.

1.) If you have multiple versions of the framework installed this will cause
a problem if you are using an older version with COM. When your .net
component is registered for COM interop the library that is actually being
loaded by the system is mscoree.dll which launches the newest version of the
CLR. If you want to specify a version and or to prohibit your component from
loading if that version does not exist you need an app.config file for your
vb6 app. app.configs are only for .net apps but since we are loading the CLR
it will be looking for one anyway. Name the file App.exe.config, and replace
App with your applications name. Here are the contents of that file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
 <requiredRuntime version="v1.1.4322"/>
 <supportedRuntime version="v1.1.4322" />
</startup>
</configuration>

This doesnt help for debugging because it seems that vb6 compiles on the fly
or in memory so no exe is generated. So to fix this for development I suggest
removing non supported framework versions from your machine.

2.) My other problem is that whenever I debugged the app and stopped
debugging, then started a second time I got an exception from the remoting
services stating that the client name was already in use. The client name is
specified in your conf file you load through remotingconfiguration.configure.
What i found to be the problem is that in vb6 while you debug the app runs
under the same process ID as the IDE, so when you stop debugging for some
reason I believe the CLR is still running with this configure info still
loaded. My fix for it was to check remotingconfiguration.applicationNam for a
value and if null then to load the configure method.

regards,
Josh

> I've too problems with a remoting component COM exposed. Works sucessfully
> ..NET called, but COM invocation raises  -2146233077 (8013150b)  error .
[quoted text clipped - 27 lines]
> >
> > Thanks, Josh
Scott - 24 May 2006 14:34 GMT
> This doesnt help for debugging because it seems that vb6 compiles on the
> fly
> or in memory so no exe is generated. So to fix this for development I
> suggest
> removing non supported framework versions from your machine.

When debugging with multiple versions of the framework on your machine, you
can create an app.config file for VB6.  Call it vb6.exe.config and put it in
the VB6 directory.  This should allow you to specify which version of the
framework will be loaded up.
Josh Bernard - 24 May 2006 14:43 GMT
haha that makes sense, I dont know why I wasnt thinking of that for debugging!

thanks

> > This doesnt help for debugging because it seems that vb6 compiles on the
> > fly
[quoted text clipped - 6 lines]
> the VB6 directory.  This should allow you to specify which version of the
> framework will be loaded up.
jgochin - 28 May 2006 08:30 GMT
Scott,

Thanks for the tip, I was having a similar problem with a .NET CCW and VB6.  
I knew the problem was that the app.config elements required by my component
weren't being loaded. It was a very difficult problem to debug due to the
lack of debugger information. Finally I read this thread and it clued me into
the problem; the placement and the name of the app.config.

From what I can infer from the, "vb6.exe.config answer" is that the
app.config required for the CCW needs to be in the same directory as the
executable that instanciates it, and have the same name as the executable
with ".config" appended to it. And the executable does not have to be .NET.  
My problem was that my .NET test application wasn't exhibiting the same
problem because it had an app.config.  

Well it’s working now.

Oh, and for what its worth, I too was trying to use remoting as well, except
I was working the Windows Communication Framework.

Thanks Again!
Jeff Gochin
MCP, MCAD

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.