472,372 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,372 software developers and data experts.

C# Interop with Remote COM Object

I'm having trouble connecting to a remote COM object using Reflection. I've
got a Web Form using C# that needs to connect to a COM object on a remote
server. The snippet of code that follows is what I've got (and found through
all of my research as the necessary code):

Type remoteType = Type.GetTypeFromProgID(r2wprogid, r2wserver) ;
object remoteObject = Activator.CreateInstance(remoteType, true) ;

The call to the Activator.CreateInstance continually causes an exception
stating that the remote server is unavailable. However, if I run the
associated code in my old 'standard ASP' page, there is no problem connecting
and performing my function calls.

Can anyone see something specific that I'm missing that would cause my Web
Form to be unable to connect to the remote server? Any ideas and suggestions
would be appreciated.
Nov 17 '05 #1
2 5533
Bryan,

By default, ASP.NET runs under the ASPNET local account, which doesn't
have access to the network. Since you are trying to access an object over
the network, it is most likely that it is failing here.

What you need to do is run the page under a user account which can
access the object on the network. You can do this through impersonation
(using the WindowsImpersonationContext class), or by setting the identity
tag in the web.config file appropriately.

To verify this is the issue, create a windows forms application, and try
making the same call. If it succeeds, then the solution above should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bryan Tubbs" <Br********@discussions.microsoft.com> wrote in message
news:99**********************************@microsof t.com...
I'm having trouble connecting to a remote COM object using Reflection.
I've
got a Web Form using C# that needs to connect to a COM object on a remote
server. The snippet of code that follows is what I've got (and found
through
all of my research as the necessary code):

Type remoteType = Type.GetTypeFromProgID(r2wprogid, r2wserver) ;
object remoteObject = Activator.CreateInstance(remoteType, true) ;

The call to the Activator.CreateInstance continually causes an exception
stating that the remote server is unavailable. However, if I run the
associated code in my old 'standard ASP' page, there is no problem
connecting
and performing my function calls.

Can anyone see something specific that I'm missing that would cause my Web
Form to be unable to connect to the remote server? Any ideas and
suggestions
would be appreciated.

Nov 17 '05 #2
Nicholas,

Thanks for your post and suggestion. Unfortunately, I have the identity tag
in the web.config file set to impersonate. I did, however, try your
suggestion of creating a Windows app to see if I could get the COM object to
instantiate successfully and was unable to get that to work either.

Any other suggestions?

Thanks,
Bryan Tubbs
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
4
by: Martin Maat | last post by:
Hi. I am using a COM component from managed code doing the following: Type type = Type.GetTypeFromCLSID(new Guid("B70FAAE6-4F85-480A-B1C5-DC9A6F175BFC"), serverMachineName, true); history =...
0
by: Cat_Vasiliy | last post by:
Hello. Look i have an .idl file like this: import "comcat.idl"; import "oaidl.idl"; import "ocidl.idl"; import "objidl.idl";
0
by: Ollie Riches | last post by:
I am using COM Interop to access and execute a remote DTS package. I have taken the code from the KB article http://support.microsoft.com/kb/319985/EN-US/ and converted this into C#. I have a...
12
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
3
by: Michel Smit | last post by:
I'm running into another problem with my component. I'm trying to use .NET remoting to avoid complex firewall issues. I have a webserver which is the client machine and a database server which...
0
by: Vimal Thakkar | last post by:
Hi, I have created one console base application which uses third party control FREDI. FREDI provides COM Control FREDI.TLB to be used with .NET. When i am adding reference of FREDI.TLB in my...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.