Interoperating
Your Existing Applications With .NET
Host: Sriram J – Technical Specialist, Microsoft India
August
2, 2002
Moderator: Hello All
Moderator: Welcome to eXPerienceDotNet Expert Chat
Moderator: Today's topic is Interoperating Your Existing Applications
With .NET
Moderator: and our expert host is Sriram J
Moderator: Sriram is a Technical Specialist in Microsoft India
Moderator: And so over to Sriram
Moderator: (Mahesh) Can my existing VB6 applications run under .NET
Platform?
SriramJ_MS: The answer is yes.
SriramJ_MS: However it is important to make a decision
whether you can move it to .NET CLR using the upgrade wizard or not
SriramJ_MS: if not com interop is always there
Moderator: (Dot) Can any one tell, whether C# supports late binding?
SriramJ_MS: Late Binding is done using means of reflection
in DotNet
SriramJ_MS: U have to create a assembly Load
SriramJ_MS: get its object and type
SriramJ_MS: and then invoke the method
Moderator: (sriram) I have an MTS/ASP Application. Can I have them
along with my .NET Platform and Continue the new Developments on .NET
?
SriramJ_MS: Yes pretty much
SriramJ_MS: ASP and ASP.NET coexist beautifully
SriramJ_MS: Same applies to COM and Assemblies
SriramJ_MS: But however moving from ASP to ASP.NET has
really tangible performance benefits
Moderator: (Mahesh) How can I call windows dll in dot net?
SriramJ_MS: Use the attribute available
SriramJ_MS: In system.runtime.interopservices
Moderator: (JohnnyV) Can you tell me the method to call my existing
windows application on the client side from my ASP.NET web app?
SriramJ_MS: That will be the last thing I allow anybody
to do in a Application
SriramJ_MS: However the method to do so is use system.diagnostics.process
object
SriramJ_MS: and then specify process.start with the exe
name as parameter
SriramJ_MS: but please don't do so from ASP.NET
Moderator: Sriram, your question has been answered by SriramJ already.
Do you have nay clarifications?
Moderator: (sriram) How do my MTS Components Behave in .NET Platform?
SriramJ_MS: Can you be more clear in what do you mean
by behave is it the manner in which they get invoked
SriramJ_MS: or the way the calls are passed between
Moderator: (sriram) how they have to be invoked and deployed?
SriramJ_MS: Understanding your MTS components are COM
Components it is still a COM interop approach which you take for the
same
SriramJ_MS: Best performance is achieved when these are
in COM + and Windows 2000
SriramJ_MS: U can invoke a COM component using directly
the reference tab in COM which internally creates a COM Callable Wrapper
SriramJ_MS: then call the MTS/COM Component straight from
your .NET Application
SriramJ_MS: MTS components can straight away be hosted
in COM+
SriramJ_MS: no rewrite is required
SriramJ_MS: That is not generally the case
SriramJ_MS: I can't say what is wrong at this point without
seeing the code and what it does
Moderator: (als) Can you please elaborate on the System.Diagnostics
namespace for calling know windows applications like Notepad.exe from
a Web Application (ASP.NET)
SriramJ_MS: I am typing in some sample code it should
help you understand
SriramJ_MS: Dim oproc as new system.diagnostics.process
SriramJ_MS: oproc.start("notepad.exe")
SriramJ_MS: But please don't do this from ASP.NET
SriramJ_MS: It would not be a sensible option
Moderator: (sriram) Is it possible to take MTS COM directly to .NET
or I have to change it to com+ and use it?
SriramJ_MS: COM+ on windows 2000 would be the better bet
always
Moderator: (Kumar) What should be scenarios in under which the components
should be moved to be written as ServicedComponents?
SriramJ_MS: if you dont want the performance cost which
comes with com interoperability then rewrite it as serviced components
Moderator: (sriram) Can i Interop between the WinCE Apps and .NET
Server Components
SriramJ_MS: Yes
SriramJ_MS: use the .NET CompactFramework for new Applications
SriramJ_MS: and use XMLHTTP for interop with web services
from pocket pc
SriramJ_MS: or winCE
SriramJ_MS: and more socket stuff
SriramJ_MS: you have also MSMQ to interop with
SriramJ_MS: depends upon app scenario what you use
Moderator: (sriram) Can Apps Developed for WinCE 2.0 using eVB take
advantage of the .NET Components? What about the Connectivity?
SriramJ_MS: The four options above mentioned are there
and with Socket is very much possible along with MSMQ for Async in
EVB
Moderator: (sreejumon) Is .NET provides any features to communicate
with AS/400 system. I mean with out existing COM components?
SriramJ_MS: use Host Integration Server 2000
SriramJ_MS: but Com will still be a Requirement for Legacy
Moderator: (Kumar) Except for the interoperability costs, there's
nothing to lose even if my components remain as COM+ components. But
what about the components designed a Neutral Apartment components?
Would they benefit, except from interoperability, be shifting to .NET?
SriramJ_MS: you can make a apartment threaded component
(especially in VB6) into a free threaded one that is the benefit
SriramJ_MS: And if you dont want that benefit
SriramJ_MS: you have got nothing to lose
Moderator: (sriram) XMLHttp Does It Mean I have to use WebServies...
Instead of COM Components
SriramJ_MS: do you write COM Components in .NET Gentlemen
Moderator: (Kumar) So, no benefits for NA components?
SriramJ_MS: apart from performance you have lot of benefits
which the base class library
SriramJ_MS: which you can exploit for lesser coding flexible
data handling etc
Moderator: (sriram) No,I mean COM+ Services.
SriramJ_MS: you can using Sockets if it is com Components
Moderator: (Anurup) In aSP.NET, if we create an object of type Excel.application,
even after setting the object to nothing, in the taskmanager, under
the Processes tab, Excel.exe is available. How to kill this instanace
of the object?
SriramJ_MS: did you specificy excel.quit
Moderator: (mrinal: r nFor interoperability is it necessary to register
assemblies with GAC r n(mrinal) For interoperability is it necessary
to register assemblies with GAC?
SriramJ_MS: it is not mandatory it should signed with
a strong name if it is Just .NET to COM
SriramJ_MS: however if the assembly is supposed to be
using enterpriseservices
SriramJ_MS: then it should be in GAC
Moderator: (sriram) Does .Net Compact Framework has Support for XML
Based Data Access?
SriramJ_MS: Lots
SriramJ_MS: you have an XML parser in .NET CF
SriramJ_MS: and can I know further expectation of yours
so i can elaborate
Moderator: (Kumar) When a .NET public class is registered using REGASM,
registry entries are made which show MSCOREE.DLL as "both" threaded.
Assuming two clients attempt to instantiate the component, how many
times will the "COM server" get loaded in memory?
SriramJ_MS: Any way if you are calling a assembly from
COM it will only use deterministic finalization and refcount
SriramJ_MS: so it will be two
Moderator: (Kumar) Is it, as we say in VB, "multiuse" or "singleuse"?
Moderator: (Kumar) Which means, if N clients attempt to use the component,
there will be N instances ?
SriramJ_MS: single use is implemented using remoting in
.NET
SriramJ_MS: singleuse is not a direct implementation
Moderator: (mrinal) Is it possible for me generate sql query during
runtime where table name is also generated dynamically as it won't
be querying a single table. i mean there could be no. of tables that
may have relevant data , which can't be hardcoded?
SriramJ_MS: in this case build the sql query as string
and then execute the query
Moderator: (Kumar) Which means, if N clients attempt to use the component,
there will be N instances? However, you referred to two instances,
right ? Or were you talking about two refcounts?
SriramJ_MS: Dlls are Inproc and you can use singleton
in remoting
SriramJ_MS: go to .NET developer specification guide in
MSDN
SriramJ_MS: and select remoting
SriramJ_MS: and select instantiation
Moderator: (mrinal) In that case is it possible to store possible
table names in an arraylist and during runtime it can check for table
with relevant values during runtime