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 / April 2006

Tip: Looking for answers? Try searching our database.

Registering .NET assembly that used COM Interop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DWrek - 19 Apr 2006 15:48 GMT
Hello,

 I have a .NET assembly that is called from a classic ASP website. Can I
still use XCopy deployment for this assembly if it utilizes COM Interop or do
I need to use RegASM.exe? I plan to deploy the assembly in question to the
"bin" directory of my web application.

Thank you.

dwrek
"Peter Huang" [MSFT] - 20 Apr 2006 06:18 GMT
Hi  Dwrek,

Based on my research, it is hard to do that, because the ASP code will go
the traditional COM way.
Also to load a .NET assembly in legacy COM client, the COM blient is
binding to mscoree.dll. And then the mscoree.dll helped us to lauch the CLR
and host the .NET assemblly.

Also for your scenario, have you tried to run your application as asp.net
application so that we can use the .NET assembly directly.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
DWrek - 20 Apr 2006 14:30 GMT
Hello Peter,

 Thank you for the reply but you sort of lost me, which admittedly is not
hard to do. Perhaps if I explain a little further it might help.

1) The existing web application is written in classis ASP 3.0.

2) Much of the logic of the application is written in .NET assemblies that
utilize COM Interop. The assemblies have the “Use COM Interop” option
selected in the project properties and also import the namespace
“System.Runtime.InteropServices”.

3) When we deploy these assemblies for the first time we use the RegASM.exe
utility with the “/codebase” option. The assemblies are all placed in the
“BIN” subfolder of the web application.

 Here is where my question originally came from. I am finding that if I
update the assembly in question, let’s call it “foo.dll”, that all I have to
do to make use of the new methods I have added is just copy foo.dll to the
bin directory of the web application. I overwrite the existing foo.dll and it
all works. Previously we had been using “RegASM.exe /codebase” to re-register
the assembly every time we made a change to it.

 So am I just “lucky” that this is working? Should I be re-registering the
foo.dll every time I make a change to it?

 Thanks  

 - Dwrek

> Hi  Dwrek,
>
[quoted text clipped - 17 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 21 Apr 2006 08:31 GMT
Hi

The way that ASP call the .NET assembly via COM is different from the way
ASP.NET call the .NET assembly.
In the scenario that ASP call the .NET assembly via COM, we need to call
the regasm to register the COM related information into system registry.
So that when the ASP try to create the .NET assembly, the ASP will query
the registry to get the information about how to lauch the .NET assembly.

Actually when we call the Regasm, we will register the mscoree.dll as the
COM proxy.
So the process that the asp call the .NET assembly via com is as below.
ASP--->mscoree.dll----->.NET aseembly.

For now the key point is that we need to enter the COM registry information
about mscoree.dll to the registry so that the ASP---->mscoree.dll will work.

So I suggest you try to use the ASP.NET directly, so that we can go the way
as below.
ASP.NET---->.NET assembly which will avoid the registry query, because in
pure .NET we did not need registry.

Anyway, here is link for your reference, but it works in the inverse way,
.NET call COM.
http://msdn.microsoft.com/msdnmag/issues/05/04/RegFreeCOM/

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
DWrek - 21 Apr 2006 14:21 GMT
Hello Peter,

 I wish we could use ASP.NET instead of ASP but that is just not possible
at the present time for various reasons.

 What I am trying to figure out is why the assembly works after adding
methods without using regasm.exe a second time. I only used regasm.exe to
register the assembly once, when it was initially deploayed. Each time I have
made changes to the assembly I only had to copy the assembly over the
existing version. I did not use regasm.exe again yet the assembly still works
including my updated methods within the assembly. Is this to be expected or
should I be using regasm.exe every single time I make changes to the assembly
and redeploy it.

> Hi
>
[quoted text clipped - 32 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 24 Apr 2006 03:34 GMT
Dear Customer,

As I stated before, to use COM in ASP, we need the registry information.
The calling route is as below.
ASP-->MSCOREE--->.NET
After calling the regasm one time, the registry information has been
entered into the registry.
That is to say, now the ASP has known how to lauch mscoree from ASP.
The problem is that how the mscoree load the .NET assembly.
So as long as the assembly information(version, name, path...) did not
change and the mscoree knew how to lauch it that is OK.

But I still did not recommend you such hack way, because a mini version
upgrade may break the application.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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.