COM registration and registration issues under Windows.net
Mood
2002-6-23
Article Type: TUTORIAL
Difficult Level: 3/9
Version: 1.02
Windows.net will be a daily star, I like the WINDOWS 2000, I like this still not released operating system, although I don't know if it will be delayed until next year will be truly released. COM 1.5 and IIS 6 have been looking forward to for a long time, some articles and materials have begun to discuss and introduce some information about the so-called inside, such as COM Partitions, Application Recycling, Application Pooling, Configurable Levels, Low-Memory Activation Gates, HTTP . Sys, Web Administration Services, ASP Template Caching, XML Metabase, MSMQ 3.0.
Many of these features are dedicated to improving the strongness and reliability of web applications, many of which make developers feel excited and excited; the same feeling makes people think about Windows 2000 a few years ago. Prior to the release, because the relevant messages and reports also indicate some of the features that may not be placed in the final version, and there may be some features that are not mentioned in the final Windows.net version, then these fans It will also have some confusing or troubles that will be encountered, such as this.
Given the excellent performance of Windows.net and the support of COM , people will easily move on Windows.net, which is so stable so stable, until one day, you will develop DOTNET in Windows 2000 COM application is placed on Windows.net, you will find the problem. And very headache, but here is also revealing Windows.net, although there is a .NET suffix, but does not mean that it is friendly and fully supported by DOTNET technology, relatively DOTNET, it prefer COM and IIS, if it is not its boss must Give it a DOTNET running library, I want to call it Windows 2002 or Windows 2003, which will at least think that it is a For DotNET operating system.
Two tools in .NET SDK are related to the registration and type library of COM components, one is the one is .NET Services Installation Tool (RegSVCS.exe); under Windows 2000, general After we complete a DOTNET's COM component, we will run REGASM to generate type libraries and registration information, and then run regsvcs.exe to complete the work to add new Application to the COM environment, to complete the entire installation and registration task. Some people suggested that it can be used directly, because regsvcs.exe will automatically call Regasm.exe, theoretically it will do this three things:
1. It registers a CLR assembly as a COM component (equal to you running regasm.exe)
2. It produces a COM type library that uses this type library when deploying your DOTNET component to a COM directory [COM CATALOG], and you can use properties such as ApplicationName and ApplicationActivation from your assmbly. A Application is created in COM Catalog. 3. Finally, it uses the .NET Reflection API to get the properties information of each class from your assembly, update the properties settings of each class in COM Catalog, so that each class is set to Attribute when programming.
These steps work very well in the Windows 2000 environment, but when you want to get these COM to the Windows.net environment, you will encounter trouble when you register it to Windows.net, you will have trouble. Error, result, no registration, or you can't complete the registration process.
From Event Viewer, you can see some DUMPs, but I promise that there is no help to you, and I have placed this information in the news group and BBS, and of course, including Microsoft. Many netizens confirmed that they can restore and reproduce this mistake in their own circumstances, but there is no way to provide any solution, and finally I started waiting for Microsoft about the PATCH for Windows.net, starting from Windows.net 3604 to 3615, 3621 Almost three versions of these Windows.net have the same problem, and recently there are two new version numbers of Windows.Net beta release, but I have been tired of installing the application software on these systems. So can't confirm that the two versions have been solved :)
System.EnterpriseServices.RegistrationException: Unable to open com 1.0 catalog to configure components. -> system.Runtime.InteropServices.com. Abimenttion (0xC0000005): Exception from HRESULT: 0xC0000005.
At System.EnterpriseServices.admin.icatalog.getCollection (String BstrCollname)
At System.EnterpriseServices.RegistrationDriver.prepdriver (Applicationspec & Spec)
--- End of Inner Exception Stack TRACE ---
Server Stack TRACE:
At System.EnterpriseServices.RegistrationDriver.installassembly (String Assembly, String & Application, String Partition, String & TLB, InstallationFlags Installflags, Object Obsync)
At System.EnterpriseServices.RegistrationHelpertx.installassembly (String Assembly, String & Application, String Partition, String & TLB, InstallationFlags InstallFlags, Object Sync)
at System.Runtime.Remoting.Messaging.Message.Dispatch (Object target, Boolean fExecuteInContext) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage (IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception RethRown At [0]:
At system.Runtime.remoting.Proxies.RealProxy.HandlereturnMessage (iMessage Reqmsg)
At system.Runtime.Remoting.Proxies.RealProxy.privateInvoke (MessageData & Msgdata, INT32 TYPE)
At System.EnterpriseServices.RegistrationHelpertx.installassembly (String Assembly, String & Application, String Partition, String & TLB, InstallationFlags InstallFlags, Object Sync)
At System.EnterpriseServices.RegistrationHelper.TrytransactedInstall (String Assembly, String & Application, String Partition, String & TLB, InstallationFlags Installflags)
At System.EnterpriseServices.RegistrationHelper.Installassembly (String Assembly, String & Application, String Partition, String & TLB, InstallationFlags Installflags)
At system.EnterpriseServices.internal.comManagedImportutil.installassembly (String Asmpath, String Parname, String Appname)
If you have also encountered the same problem (or on Windows XP, I didn't install and use any XP version, so I don't know if there is such a problem under Windows XP. If not, then how would you happiness? Now there is a simple way to solve this problem, and Roman Kiss has an article on CodeProject About .NET / COM Installation Tool, this article has long been there, DOTNET BETA2, I recently discovered that it may Can solve the problems encountered.
You can use two methods to solve this problem before Microsoft has published a new Patch:
1. First, install it and debug its installation and debug in the Windows 2000, then export these Application to a MSI installation package, then install this package in the Windows.net environment. This approach can avoid such problems, but very unstable, that is, you can successfully install, sometimes you can't. In addition, if you are the development environment or other applications on Windows.net, you will feel very uncomfortable and frustrated, frequent switching on two systems and non-stop packages, you can forget to do what you want to do. What is it.
2. Another way is to write a procedure for the registration, because from the error message, there is a problem with the dem catalog api under Windows.net from the error message. Maybe the current Regsvcs only recognizes the current regsvcs. 1.0 API, and Windows.net is at least 1.5. I also tried to do this, simple SAMPLE or API manual made me quickly recovered the same error when using Regsvcs, the only difference is that I can only step Debug, know that the error is in that statement. Until I saw Roman Kiss articles, I finally knew what is the right way. The following is the step of solving:
1. First go [CodeProject 96.4k] to get this Project program, decompress, remove Comadmin's reference, add a new Windows.Net Comadmin reference library, then compile the entire Project. Finally, you will get a REGASM2.EXE program, which is a new Regsvcs registration program.
2. Switch to the test program directory in the Project to register.
Regasm attributetester.dll /tlb:attributetetester.tlb regasm2 attributeterster.dll
3. Open Component Services COM Explorer, you will find that the component has been registered correctly, and the properties of Application and Each component are set as set in your program, this is very important because I use it. The first solution (using the poured mounting package), often is not easy to install the component package success, but find that these attribute information is not set correctly, more attributes are blank. (Similar situations also occur in the component installation package forth from Windows.net COM , reinstalling to the Windows 2000 environment, theoretically Windows.net supports additional higher version of the installation package format, because when you fall out Windows .NET allows you to choose whether it is compatible with COM Admin 1.0 formats)
4. Finally, we have a simple test, see if this approach works correctly, I simply use Ole / Com object viewer, it has a benefit, that is, all CLR assembly is registered to COM , you are here. In the tool, you can see it automatically categorized to GroupD by Component Category -> .Net Category, it is very convenient to find your components. Select the component, then right click to select CREATE INSTANCE in the menu to simply test whether it is running normally.
5. It seems that the result is not bad, it is what we want, from DUMP from DebugView, is the information that specially output in our Download's code.
I don't know if this is a pleasant trip, but I can't worry if I have a registration of COM components under Windows.net. The last released Windows.net must have this problem, so before this time, I think, just as Guangzhou is now, you can use a word to describe: depressed. There is no rain in the network, and there are always people who make you feel relaxed, so I must thank Roman Kiss.
especially:
This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization.