public class DataCom:System.EnterpriseServices.ServicedComponent
{
    public DataCom(string conn)
    {    }
}

解决方案 »

  1.   

    public class DataCom:System.EnterpriseServices.ServicedComponent
    {
        public DataCom(String conn)
        {    }
    }
      

  2.   

    错误的原因是:
        DataCom是从ServicedComponent类派生的,DataCom的构造函数必须调用父类ServicedComponent的构造函数.
        当您删除public DataCom(string conn)中的参数时,public DataCom()成了DataCom类型的默认构造函数,系统会自动调用ServicedComponent的默认构造函数.而public DataCom(string conn)则不然,需要您亲自调用父类ServicedComponent的构造函数.
      

  3.   

    public class DataCom:ServicedComponent
    {
        public DataCom(string conn):base()
        {    }
    }
      

  4.   

    还是不可以!!!
    在程序集中找到无效的 ServicedComponent 派生类。 (类必须是公共的、具体的,要有公共的默认构造函数,并且满足所有其他 ComVisibility 要求) 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.EnterpriseServices.RegistrationException: 在程序集中找到无效的 ServicedComponent 派生类。 (类必须是公共的、具体的,要有公共的默认构造函数,并且满足所有其他 ComVisibility 要求)