.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Communication between x64 COM and managed DCOM server

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :.NET Framework
Hi all,

I have 64bit COM object written in C++ and 64bit (not Any CPU) managed DCOM server. When I try to pass a reference of my COM object to the managed DCOM server I get an error. After debugging I found that the wrapper in .tli returns 0x80004002 (E_NOINTERFACE). When I compile both COM object and the managed DCOM server for x86 everything works fine. I saw that tlbimp.exe tool has /machine option but when I try to use it for my 64bit binary I get the following error:

TlbImp : error TI0000 : A single valid machine type compatible with the input type library must be specified

Currently I using tlbimp.exe against 32bit binary and then copy/paste the source code shown in .NET Reflector. As far as I can see the code is not platform specific and as I said when I compile both projects for x86 everything works fine. Still it seems there is something wrong with x64 marshalling.

Thanks in advance

View Complete Post

More Related Resource Links

Error Handling: Throwing Custom Exception Types from a Managed COM+ Server Application


Exception handling semantics in .NET are based on type, so you can create custom exceptions that have their own properties and methods. In .NET, exceptions are first-class citizens, and since they're the built-in error handling mechanism, all .NET-compliant languages must support exceptions. In addition, COM+ services are available to .NET code as Enterprise Services, so you can leverage exceptions in your Enterprise Services design.In this article the author describes custom exceptions, throwing exceptions across COM interop boundaries, and working with Enterprise Services.

Bob DeRemer

MSDN Magazine March 2004

Types in Yukon: Managed UDTs Let You Extend the SQL Server Type System


The next version of SQL Server, code-named "Yukon," will offer enhanced support for user-defined types (UDTs). Because UDTs can be managed by the CLR, you can represent a wide variety of data structures to create types not possible with previous versions of SQL Server. With UDTs you can more precisely control the kind of data your type accepts, resulting in better data management. This article explores UDTs in "Yukon" and covers their design and implementation.

Peter W. DeBetta

MSDN Magazine February 2004

DCOM Interop: Generate Custom Managed C++ Wrappers for Easier COM Interoperation Using DCOMSuds


Now that you're writing managed code, you'll certainly want to use your existing COM components, but you can't simply call them directly. Instead, you have to wrap the COM component in a runtime-callable wrapper that acts as a proxy between the component and your managed code. While the CLR provides wrapper classes for this purpose, there will be times when you'll want custom objects to wrap your COM components. One way to get the low-level access you need to precisely control resource cleanup, pass security information, and get access to CLR features is to write your own wrapper class in managed C++. This article shows you how.

Vishwas Lele

MSDN Magazine August 2003

Does SQL Server have to load and init statics every time a SQL/CLR managed proc is invoked?

We are working with SQL/CLR stored procedures, triggers etc and it seems that all assemblies we use are unloaded/loaded every time a proc or trigger or TVF is called. Is this true? Is there any way to retain data between invocations of procs? for example can I create some static struct or object that I can setup once and then just refer to after that, so that unless we terminate SQL server, the static data is always in memory? Thanks PS: This was originally posted here, but that forum seems to be rarely frequented.  

How to setup windows server 2008 to enable socket communication?

I wrote a simple socket program, which listens to the 82 port, then receives and sends data through it. I tested the program on my local machine and it works fine, but after I published the program onto my windows server 2008, it does not work anymore. I guess it should be the firewall causing the problem, so I added rules to allow 82 port for both in and out bound, and I also add my application to the allowed program list for passing firewall, but still doesn't work, how could I solve it?   The windows server 2008 machine has a public network IP address, while my workstation is in a local network without public IP address, I connect to server 2008 through a router which has a public IP address. Is that the problem?   thanks! Regards! directfriends.net

Integrating the Office Communication Server Archiving Server with a sharepoint dashboard?

Is this possible? I'd like all our communications (which are currently through the yahoo network) to be logged in a central archiving server. This I understand is OOB. I'd then like these archives to be accessible through a share point page. I want to build a CRM dashboard such that when a company is selected it will show all the correspondence on one page with any employee with that company automatically. I'll ask on the sharepoint forums too. Thanks Jamie

TCP Client/Server communication: NetworkStream.Write() send partial data unless close() method is re

Hi to all,
I wrote a simple client-server application that comunicate through NetworkStream class. The problems comes when stream.close() and client.close() methods are called. It look like only the first 10415 bytes are sent once those methods are called. So, if the data to send is more than this size, it is automatically truncated.

If I  remove both stream/client close() methods from the code, the data is fully received whatever the size is. I tried various alternative solutions (the ones marked as comments in the sample code), but none of them works.
The only thing that seems to work is adding a manual delay before the close() methods execute with something like that:

For Counter as integer = 0 to 10

The problem is that after delay I still don't know if all the data has been transfered or not. In addition to that, I will have to wait 10 seconds before sending another request, even if the response is just a few bytes of data. I could change at runtime the number of seconds to wait according to the size of the data to send, but I still think that delay is not a solution and will cause adverse effects.

So, for now the only working solution is to remove both Stream/Client Close() methods from

communication C# and sql server for every 10 second


Hi all. I have a huge update query that effects many many records. in each reason, this query need 20 minutes for execute.

I want to find this quety situation by c# code for every 10 seconds or more.

what shpould I do? how sql server says this to us? what I need for communication between c# and sql server? Is this possible?

Bulk copy from SQL Server to a managed app on network.


I am dealing with a perf issue.

We have code (SQL CLR triggers) that can take a few changes from a table and send them over a network to a recipient server, this recipient caches the data in memory, and appears as a .Net collection to local apps running on the recipinet server (there is no SQL server running on the recipient).

As changes are made to the table in SQL server, the managed trigger gets these, packs them into a class we designed (that stores rows/columns and some other details) and then uses binary serialization to send them over the network, the recipinet server (a managed code NT service) deserializes and updates its local cached copy.

The network IO is done by our own simple classes that use TcpClient and so on.

As a trigger this works OK, so I leveraged the trigger code so that I can also use it to pre-populate the remote server, by "pretending" every row has been changed and just sending the data, so we use the C# trigger library as a bulk upload from SQL Server to our remote recipient.

But this is proving far too slow, I am still pinning down why and where, but suspect the network cost is high, 10 rows from a table with 10 columns ends up being sent as a serialzied blob 10,500 byte long, or about three times the size of the raw data bytes in the rows.

So our bulk upload is taking hours for ve

Managed plugin algorithm with SQl SERVER 2008 R2


I'm following the steps of the tutorial on how to construct a managed data mining plugin algorithm with VS2008 and SQL server 2008 R2. The shell.dll and DMPluginWrapper.dll were registered successfully. The file msmdsrv.ini was manually updated with the MyCompany_Managed_Plugin_Algorithm entry. The Analysis SErvices was restarted after the change made. When the shell algorithm was tested with Business Intelligence Development Studio, the error is:

"Unable to retrieve a list of supported data mining algorithms. Make sure you are connected to the correct Analysis Services server instance and the Analysis Services server named localhost is running and configured properly. You can continue with a default list of data mining algorithms."

When I checked the event log and found the message of

"The data mining algorithm provider (ProgID: BB62E1CB-95B9-4947-882C-6CD6EFA8978A) for the MyCompany_Managed_Plugin_Algorithm algorithm cannot be loaded. The following system error occurred:  Class not registered "

I have no idea where the problem is. Any comments will be greatly appreciated. 


Managed Properties in the Advanced Search page of Sharepoint Server 2007


Hi all,

I want to search a custom field in a SharePoint list by using the Advanced Search page. I followed this post http://interdata.cl/?p=368 and i was able to find all metadata properties without any blank.  For example, I´ve created columns called "Baseline", or "Milestone" and it works properly, but for example, "Document Code" doesn´t works.


The field shows up correctly in the Advanced Search properties, but whenever I do a search trying to specify my custom property I get the error message: "Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.".

if I look at the Managed property in Central administration, it tells me "Number of objects with this property: more than 350", so the data is mapped correctly to the property.


Thanks in advance,



is DCOM a security risk to SQL Server?

Part of the new security scan tool states that DCOM is a security risk and should be turned off.   However, I don’t know if the tool takes into account SQL’s dependency on MSDTC.  Thus I need definitive evidence showing when and where MSDTC is required for SQL Server and for what version of SQL.  So what I am looking for is evidence from MS stating that MSDTC is definitely ‘REQUIRED’ for SQL so I can point security team to said documentation regarding MSDTC and DCOM.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend