• MSMQ&Com+ Service: How to create an Com+ Service in .NetFramework


    1.create an library project named ComPlusService, and add references to System.EnterprisesServices & System.Messaging;
    2.sample codes

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Messaging;
    using System.EnterpriseServices;

    namespace ComPlusService
    {
        [System.EnterpriseServices.TransactionAttribute(
      System.EnterpriseServices.TransactionOption.Required)]
        public class MessageMover : System.EnterpriseServices.ServicedComponent
        {
            private System.Messaging.MessageQueue sourceQueue;
            private System.Messaging.MessageQueue destinationQueue;
            public MessageMover()
            {
            }

            public System.Messaging.MessageQueue Source
            {
                get
                {
                    return sourceQueue;
                }
                set
                {
                    sourceQueue = value;
                }
            }
            public System.Messaging.MessageQueue Destination
            {
                get
                {
                    return destinationQueue;
                }
                set
                {
                    destinationQueue = value;
                }
            }
            [System.EnterpriseServices.AutoComplete()]
            public void Move()
            {
                System.Messaging.Message sourceMessage;
                sourceMessage = sourceQueue.Receive(
                   System.Messaging.MessageQueueTransactionType.Automatic);
                destinationQueue.Send(sourceMessage,
                   System.Messaging.MessageQueueTransactionType.Automatic);
            }
        }
    }

    set the assemly strong name;
        i) create key pair;
            prompt command: sn -k key.snk;
       and then key.snk will be generated
        set assemlyInfo.cs as following:
            [assembly:AssemblyDelaySign(false)]
            [assembly:AssemblyKeyFile("key.snk")]
            [assembly:AssemblyKeyName("")]

    build the project and generate complusservice.dll;

    3. register the com+ Services;
    prompt command: regsvcs complusservice.dll
    //Exception occurs: the transaction manager is not avalible
    //solution: prompt command: msdtc -install

    4.create a client application to consume the com+ service;


     

  • 相关阅读:
    30款超酷的HTTP 404页面未找到错误设计
    java与java学习路线
    程序员最核心的竞争力
    群智能优化算法-测试函数matlab源码
    如何用Latex合并多个pdf文件?
    Latex--TikZ和PGF--高级文本绘图,思维绘图,想到--得到!
    学无止境 气有浩然
    Latex中定义、定理、引理、证明 设置方法总结
    WeUI
    微信JS SDK Demo 官方案例
  • 原文地址:https://www.cnblogs.com/Winston/p/1145363.html
Copyright © 2020-2023  润新知