[EnterpriseServices] uses assembly to define how our components are registered in COM +

Source: Internet
Author: User
Tags define class definition dedicated server
Enterprise|services Zheng @ultrapower


Use the following assembly to define how our components are registered in COM +, where:



The ApplicationName property is the name of the COM + application that is displayed in the COM + catalog and Component Services management consoles.



[Assembly:applicationname ("Mydll.interface")]



The Description property provides instructions for COM + applications in the COM + catalog and Component Services management consoles.



[Assembly:description ("My Serviced Component")]



The ActivationOption property indicates whether the component is activated in the caller's process. Here we set the activation.option to the server, meaning that "the component will be activated in the dedicated server process."



[Assembly:applicationactivation (Activationoption.server)]



The ApplicationAccessControl property sets the access management and authentication levels. Here we set: Do not force access checks on this application; The authentication level of the call is none; The impersonation level is delegated.



[Assembly:applicationaccesscontrol (Value=false,



Impersonationlevel=impersonationleveloption.delegate,



Authentication=authenticationoption.none)]

Once you have implemented the above definitions in your code, you can simply pass the
RegSvcs MyDLL.DLL or Register our COM + components by using the following class definition, called the method:
"String Strcomplusdllfilepath = Rootforumsdirectory + @" \bin\mydll.dll ";
UltraPower.InstallClassLib.InstallClassRegsvcs.Install (Strcomplusdllfilepath); "
You can avoid the manual configuration of COM + applications, save a lot of trouble. Namespace Ultrapower.installclasslib
{
public class Installclassregsvcs
{
Public Installclassregsvcs ()
{
}

Install#region Install
---Override the ' Install ' method.
public static void Install (String strcomplusdllfilepath)
{
---checkpoint
Trace.WriteLine (String. Format ("Register COM + component {0}", Strcomplusdllfilepath));

---action
Process installprocess = new process ();
ProcessStartInfo installinfo = new ProcessStartInfo ("Regsvcs.exe");
Installinfo.arguments = "" + Strcomplusdllfilepath;
Installinfo.windowstyle = Processwindowstyle.hidden;
Installprocess.startinfo = Installinfo;

Run
Installprocess.start ();
Installprocess.waitforexit ();

}
#endregion

}
}
Namespace Ultrapower.installclasslib
{
public class Installclassregsvcs
{
Public Installclassregsvcs ()
{
}

Install#region Install
---Override the ' Install ' method.
public static void Install (String strcomplusdllfilepath)
{
---checkpoint
Trace.WriteLine (String. Format ("Register COM + component {0}", Strcomplusdllfilepath));

---action
Process installprocess = new process ();
ProcessStartInfo installinfo = new ProcessStartInfo ("Regsvcs.exe");
Installinfo.arguments = "" + Strcomplusdllfilepath;
Installinfo.windowstyle = Processwindowstyle.hidden;
Installprocess.startinfo = Installinfo;

Run
Installprocess.start ();
Installprocess.waitforexit ();

}
#endregion

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.