Why can't I register a serviced component in the COM+ Catalog

P

Paul Custance

I am am trying to register my DLL in the COM+ Catalog. To do this I am
taking the manual approach and using the regsvcs.exe tool provided with the
..net framework 2005. I have strong signed the assemblies using Visual Studio
2005.

However when I regiser the dll it comes back that I have derived classes
found in the assembly and won't register, saying that classes must be
public, concrete and have a default constructor. Why is this happening? As
far as I'm aware I haven't got any derived classes apart from the serviced
component which is required. Below is my code for my class:

using System;
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;

namespace StepByStep7_1
{
public class NorthwindSC : ServicedComponent
{

private SqlConnection sqlcnn;
private SqlDataAdapter sqlda;
private DataSet ds;

public NorthwindSC()
{
// Create a connection to the
// Northwind SQL Server database
sqlcnn = new SqlConnection("data source=(local);initial
catalog=Northwind User ID = SAassword = *********");
}

// This method executes a SELECT query and
// returns the results in a DataSet object
public DataSet ExecuteQuery(string strQuery)
{
// Create a SqlDataAdapter object to talk to the database
sqlda = new SqlDataAdapter(strQuery, sqlcnn);

// Create a DataSet object to hold the results
ds = new DataSet();

// Fill the DataSet object
sqlda.Fill(ds, "Results");
return ds;
}

// This method updates the database with the changes in a DataSet
object
public int UpdateData(DataSet ds)
{
// Update the database and return the result
SqlCommandBuilder sqlcb = new SqlCommandBuilder(sqlda);
return sqlda.Update(ds.Tables["Results"]);
}
}
}

Many thanks for your help in advance

Paul
 
M

Michael Nemtsev

Hello Paul,

You know, it's a common problem for VS 2005.
This question was risen several times, but I couldn't find an answer.

Try to build a simple Serviced class in VS 2003, register it and then convert
solution to .net 2.0
It works for me in some cases

PC> I am am trying to register my DLL in the COM+ Catalog. To do this I
PC> am taking the manual approach and using the regsvcs.exe tool
PC> provided with the .net framework 2005. I have strong signed the
PC> assemblies using Visual Studio 2005.

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
W

Willy Denoyette [MVP]

Remove this:
[assembly: ComVisible(false)]
from the assemblyinfo.cs file.
or annotate your exported classes with ComVisible(true).

VS2005 add this line in new and updated projects to overrule the default
ComVisible (true) attribute, I really don't know the rationale behind this
change.

Willy.

|I am am trying to register my DLL in the COM+ Catalog. To do this I am
| taking the manual approach and using the regsvcs.exe tool provided with
the
| .net framework 2005. I have strong signed the assemblies using Visual
Studio
| 2005.
|
| However when I regiser the dll it comes back that I have derived classes
| found in the assembly and won't register, saying that classes must be
| public, concrete and have a default constructor. Why is this happening? As
| far as I'm aware I haven't got any derived classes apart from the serviced
| component which is required. Below is my code for my class:
|
| using System;
| using System.Data;
| using System.Data.SqlClient;
| using System.EnterpriseServices;
|
| namespace StepByStep7_1
| {
| public class NorthwindSC : ServicedComponent
| {
|
| private SqlConnection sqlcnn;
| private SqlDataAdapter sqlda;
| private DataSet ds;
|
| public NorthwindSC()
| {
| // Create a connection to the
| // Northwind SQL Server database
| sqlcnn = new SqlConnection("data source=(local);initial
| catalog=Northwind User ID = SAassword = *********");
| }
|
| // This method executes a SELECT query and
| // returns the results in a DataSet object
| public DataSet ExecuteQuery(string strQuery)
| {
| // Create a SqlDataAdapter object to talk to the database
| sqlda = new SqlDataAdapter(strQuery, sqlcnn);
|
| // Create a DataSet object to hold the results
| ds = new DataSet();
|
| // Fill the DataSet object
| sqlda.Fill(ds, "Results");
| return ds;
| }
|
| // This method updates the database with the changes in a DataSet
| object
| public int UpdateData(DataSet ds)
| {
| // Update the database and return the result
| SqlCommandBuilder sqlcb = new SqlCommandBuilder(sqlda);
| return sqlda.Update(ds.Tables["Results"]);
| }
| }
| }
|
| Many thanks for your help in advance
|
| Paul
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top