[EnterpriseServices]利用assembly定义我们的组件在COM+中的注册方式

整理者 郑昀@UltraPower

利用以下assembly定义我们的组件在COM+中的注册方式,其中:

ApplicationName 属性是"COM+ 目录""组件服务管理"控制台中显示的 COM+ 应用程序的名称。

[assembly: ApplicationName("MyDLL.Interface")]

Description属性为"COM+ 目录""组件服务管理"控制台中的 COM+ 应用程序提供说明。

[assembly: Description("My Serviced Component")]

ActivationOption 属性指示是否在调用方的进程中激活组件。我们这里将 Activation.Option 设置为服务器,意即“组件将在专用服务器进程中被激活”。

[assembly:ApplicationActivation(ActivationOption.Server)]

ApplicationAccessControl属性设置访问管理和验证级别。这里我们设置:不对此应用程序强制进行访问权限检查;调用的身份验证级别为无;模拟级别为委派。

[assembly: ApplicationAccessControl(Value=false,

                                  ImpersonationLevel=ImpersonationLevelOption.Delegate,

                                  Authentication=AuthenticationOption.None)]

代码中实现了以上定义后,就可以简单地通过
regsvcs MyDLL.DLL或者通过下面的类定义来注册我们的COM+组件,调用方法是:
“string strComPlusDLLFilePath  = RootForumsDirectory + @"/bin/MyDLL.dll";
    UltraPower.InstallClassLib.InstallClassRegsvcs.Install(strComPlusDLLFilePath);”
就可以免手工配置COM+应用了,省去了许多麻烦。

namespace  UltraPower.InstallClassLib
{
    
public class InstallClassRegsvcs
    
{
        
public InstallClassRegsvcs()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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


    }

}



整理者 郑昀@UltraPower

利用以下assembly定义我们的组件在COM+中的注册方式,其中:

ApplicationName 属性是"COM+ 目录""组件服务管理"控制台中显示的 COM+ 应用程序的名称。

[assembly: ApplicationName("MyDLL.Interface")]

Description属性为"COM+ 目录""组件服务管理"控制台中的 COM+ 应用程序提供说明。

[assembly: Description("My Serviced Component")]

ActivationOption 属性指示是否在调用方的进程中激活组件。我们这里将 Activation.Option 设置为服务器,意即“组件将在专用服务器进程中被激活”。

[assembly:ApplicationActivation(ActivationOption.Server)]

ApplicationAccessControl属性设置访问管理和验证级别。这里我们设置:不对此应用程序强制进行访问权限检查;调用的身份验证级别为无;模拟级别为委派。

[assembly: ApplicationAccessControl(Value=false,

                                  ImpersonationLevel=ImpersonationLevelOption.Delegate,

                                  Authentication=AuthenticationOption.None)]

代码中实现了以上定义后,就可以简单地通过
regsvcs MyDLL.DLL或者通过下面的类定义来注册我们的COM+组件,调用方法是:
“string strComPlusDLLFilePath  = RootForumsDirectory + @"/bin/MyDLL.dll";
    UltraPower.InstallClassLib.InstallClassRegsvcs.Install(strComPlusDLLFilePath);”
就可以免手工配置COM+应用了,省去了许多麻烦。

namespace  UltraPower.InstallClassLib
{
    
public class InstallClassRegsvcs
    
{
        
public InstallClassRegsvcs()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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


    }

}



整理者 郑昀@UltraPower

利用以下assembly定义我们的组件在COM+中的注册方式,其中:

ApplicationName 属性是"COM+ 目录""组件服务管理"控制台中显示的 COM+ 应用程序的名称。

[assembly: ApplicationName("MyDLL.Interface")]

Description属性为"COM+ 目录""组件服务管理"控制台中的 COM+ 应用程序提供说明。

[assembly: Description("My Serviced Component")]

ActivationOption 属性指示是否在调用方的进程中激活组件。我们这里将 Activation.Option 设置为服务器,意即“组件将在专用服务器进程中被激活”。

[assembly:ApplicationActivation(ActivationOption.Server)]

ApplicationAccessControl属性设置访问管理和验证级别。这里我们设置:不对此应用程序强制进行访问权限检查;调用的身份验证级别为无;模拟级别为委派。

[assembly: ApplicationAccessControl(Value=false,

                                  ImpersonationLevel=ImpersonationLevelOption.Delegate,

                                  Authentication=AuthenticationOption.None)]

代码中实现了以上定义后,就可以简单地通过
regsvcs MyDLL.DLL或者通过下面的类定义来注册我们的COM+组件,调用方法是:
“string strComPlusDLLFilePath  = RootForumsDirectory + @"/bin/MyDLL.dll";
    UltraPower.InstallClassLib.InstallClassRegsvcs.Install(strComPlusDLLFilePath);”
就可以免手工配置COM+应用了,省去了许多麻烦。

namespace  UltraPower.InstallClassLib
{
    
public class InstallClassRegsvcs
    
{
        
public InstallClassRegsvcs()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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


    }

}



整理者 郑昀@UltraPower

利用以下assembly定义我们的组件在COM+中的注册方式,其中:

ApplicationName 属性是"COM+ 目录""组件服务管理"控制台中显示的 COM+ 应用程序的名称。

[assembly: ApplicationName("MyDLL.Interface")]

Description属性为"COM+ 目录""组件服务管理"控制台中的 COM+ 应用程序提供说明。

[assembly: Description("My Serviced Component")]

ActivationOption 属性指示是否在调用方的进程中激活组件。我们这里将 Activation.Option 设置为服务器,意即“组件将在专用服务器进程中被激活”。

[assembly:ApplicationActivation(ActivationOption.Server)]

ApplicationAccessControl属性设置访问管理和验证级别。这里我们设置:不对此应用程序强制进行访问权限检查;调用的身份验证级别为无;模拟级别为委派。

[assembly: ApplicationAccessControl(Value=false,

                                  ImpersonationLevel=ImpersonationLevelOption.Delegate,

                                  Authentication=AuthenticationOption.None)]

代码中实现了以上定义后,就可以简单地通过
regsvcs MyDLL.DLL或者通过下面的类定义来注册我们的COM+组件,调用方法是:
“string strComPlusDLLFilePath  = RootForumsDirectory + @"/bin/MyDLL.dll";
    UltraPower.InstallClassLib.InstallClassRegsvcs.Install(strComPlusDLLFilePath);”
就可以免手工配置COM+应用了,省去了许多麻烦。

namespace  UltraPower.InstallClassLib
{
    
public class InstallClassRegsvcs
    
{
        
public InstallClassRegsvcs()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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()
        
{
        }


        
#region Install
        
//---Override the 'Install' method.
        public static void Install(string strComPlusDLLFilePath)
        
{
            
//---checkpoint 
            Trace.WriteLine(string.Format("注册COM+组件 {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


    }

}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值