473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How can 2 .NET EXEs talk to each other?

This may be a simple question, but I'm new to .NET and not having much luck
finding out the answer.

I'm writing a Windows Service and want to develop a separate program that
provides a user interface so the user can control the service. They are both
being developed in Visual C# .NET. What is the best way to get them to talk
to each other?

I've heard of remoting, but not sure that is what I need, it seems kind of
overcomplicated and I'm not all that keen on opening TCP/IP ports. But I'll
read into it further if someone replies and tells me that would do what I'm
trying to achieve. What would be great is if there is a way for the UI
program to call methods in the service like what was possible with ActiveX
EXEs.

I also thought of having the bulk of the service code in a class library,
which both programs could connect to and share data that way. However, both
programs seem to get an entirely different instance of the DLL (I did a test
with static variables) and I can't find a way to make a variable shared
between all programs using the DLL.
Jul 21 '05 #1
8 2371
The service code has classes defined in it, yes? If so, just make a
reference to the .exe service and then you can make instances of the classes
in that assembly and call whatever methods you like.
"Dave" <no****@nospam.com> wrote in message
news:Oe**************@TK2MSFTNGP11.phx.gbl...
This may be a simple question, but I'm new to .NET and not having much
luck
finding out the answer.

I'm writing a Windows Service and want to develop a separate program that
provides a user interface so the user can control the service. They are
both
being developed in Visual C# .NET. What is the best way to get them to
talk
to each other?

I've heard of remoting, but not sure that is what I need, it seems kind of
overcomplicated and I'm not all that keen on opening TCP/IP ports. But
I'll
read into it further if someone replies and tells me that would do what
I'm
trying to achieve. What would be great is if there is a way for the UI
program to call methods in the service like what was possible with ActiveX
EXEs.

I also thought of having the bulk of the service code in a class library,
which both programs could connect to and share data that way. However,
both
programs seem to get an entirely different instance of the DLL (I did a
test
with static variables) and I can't find a way to make a variable shared
between all programs using the DLL.

Jul 21 '05 #2
When I tried doing this I got the following error....
"A reference to <long filename> could not be added. This is not a valid
assembly or COM component. Only assemblies with extension 'dll' and COM
components can be referenced."

The executable I'm trying to reference is a normal Windows .NET executable
and not the service (I'm trying to get it working with normal apps first
since they're easier to debug) but the impression I get from the error
message is you can't reference any .NET executable.

This is what I tried doing....
Project/Add Reference
Browse (on the .NET tab)
Selected the other compiled exe (debug build) and clicked OK.

"Scott M." <s-***@nospam.nospam> wrote in message
news:eo**************@TK2MSFTNGP11.phx.gbl...
The service code has classes defined in it, yes? If so, just make a
reference to the .exe service and then you can make instances of the classes in that assembly and call whatever methods you like.

Jul 21 '05 #3
What you've done is correct, but .NET wants to only reference .dll
assemblies, not .exe assemblies. You could just change the file extension
and then it will work (I know that sounds like a hack, but only the ability
to run the .exe directly will be compromised). In .NET, the only difference
between .exe and .dll is the ability to run the assembly directly.

"Dave" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
When I tried doing this I got the following error....
"A reference to <long filename> could not be added. This is not a valid
assembly or COM component. Only assemblies with extension 'dll' and COM
components can be referenced."

The executable I'm trying to reference is a normal Windows .NET executable
and not the service (I'm trying to get it working with normal apps first
since they're easier to debug) but the impression I get from the error
message is you can't reference any .NET executable.

This is what I tried doing....
Project/Add Reference
Browse (on the .NET tab)
Selected the other compiled exe (debug build) and clicked OK.

"Scott M." <s-***@nospam.nospam> wrote in message
news:eo**************@TK2MSFTNGP11.phx.gbl...
The service code has classes defined in it, yes? If so, just make a
reference to the .exe service and then you can make instances of the

classes
in that assembly and call whatever methods you like.


Jul 21 '05 #4
Dave,

Did you already look at this?
Remoting
http://msdn.microsoft.com/library/de...ngservices.asp

I cannot see from your message what program language you use however in the
VBNet resource kit is a sample of this.

I hope this helps?

Cor
Jul 21 '05 #5
If I rename the extension to .DLL will the .DLL still be able to launch as a
service though? Or should I make a separate EXE service that uses the DLL?

"Scott M." <s-***@nospam.nospam> wrote in message
news:O7*************@tk2msftngp13.phx.gbl...
What you've done is correct, but .NET wants to only reference .dll
assemblies, not .exe assemblies. You could just change the file extension
and then it will work (I know that sounds like a hack, but only the ability to run the .exe directly will be compromised). In .NET, the only difference between .exe and .dll is the ability to run the assembly directly.

"Dave" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
When I tried doing this I got the following error....
"A reference to <long filename> could not be added. This is not a valid
assembly or COM component. Only assemblies with extension 'dll' and COM
components can be referenced."

The executable I'm trying to reference is a normal Windows .NET executable and not the service (I'm trying to get it working with normal apps first
since they're easier to debug) but the impression I get from the error
message is you can't reference any .NET executable.

This is what I tried doing....
Project/Add Reference
Browse (on the .NET tab)
Selected the other compiled exe (debug build) and clicked OK.

"Scott M." <s-***@nospam.nospam> wrote in message
news:eo**************@TK2MSFTNGP11.phx.gbl...
The service code has classes defined in it, yes? If so, just make a
reference to the .exe service and then you can make instances of the

classes
in that assembly and call whatever methods you like.



Jul 21 '05 #6
Thanks, I had looked at some remoting stuff but it just looked a bit
complicated and seemed more concerned with using objects on other PCs over a
network than interprocess communication on the same PC.

Anyway, I had a play around with it today and from what I've seen so far, I
think I can use this to do what I want. Thanks!
Jul 21 '05 #7

You might want to investigate WSE 2.0

It's a way of doing remoting simply between applications -- not just using
http.

It's the bedrock of MS SOA ( Service Oriented Architecture ) which is all
about inter-app communication.
"Dave" <no****@nospam.com> wrote in message
news:Oe**************@TK2MSFTNGP11.phx.gbl...
This may be a simple question, but I'm new to .NET and not having much luck finding out the answer.

I'm writing a Windows Service and want to develop a separate program that
provides a user interface so the user can control the service. They are both being developed in Visual C# .NET. What is the best way to get them to talk to each other?

I've heard of remoting, but not sure that is what I need, it seems kind of
overcomplicated and I'm not all that keen on opening TCP/IP ports. But I'll read into it further if someone replies and tells me that would do what I'm trying to achieve. What would be great is if there is a way for the UI
program to call methods in the service like what was possible with ActiveX
EXEs.

I also thought of having the bulk of the service code in a class library,
which both programs could connect to and share data that way. However, both programs seem to get an entirely different instance of the DLL (I did a test with static variables) and I can't find a way to make a variable shared
between all programs using the DLL.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004
Jul 21 '05 #8
You would then make an .exe that calls the .dll. Just using the exe as a
"launch pad" if you will.
"Dave" <no****@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
If I rename the extension to .DLL will the .DLL still be able to launch as
a
service though? Or should I make a separate EXE service that uses the DLL?

"Scott M." <s-***@nospam.nospam> wrote in message
news:O7*************@tk2msftngp13.phx.gbl...
What you've done is correct, but .NET wants to only reference .dll
assemblies, not .exe assemblies. You could just change the file
extension
and then it will work (I know that sounds like a hack, but only the

ability
to run the .exe directly will be compromised). In .NET, the only

difference
between .exe and .dll is the ability to run the assembly directly.

"Dave" <no****@nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
> When I tried doing this I got the following error....
> "A reference to <long filename> could not be added. This is not a valid
> assembly or COM component. Only assemblies with extension 'dll' and COM
> components can be referenced."
>
> The executable I'm trying to reference is a normal Windows .NET executable > and not the service (I'm trying to get it working with normal apps
> first
> since they're easier to debug) but the impression I get from the error
> message is you can't reference any .NET executable.
>
> This is what I tried doing....
> Project/Add Reference
> Browse (on the .NET tab)
> Selected the other compiled exe (debug build) and clicked OK.
>
> "Scott M." <s-***@nospam.nospam> wrote in message
> news:eo**************@TK2MSFTNGP11.phx.gbl...
>> The service code has classes defined in it, yes? If so, just make a
>> reference to the .exe service and then you can make instances of the
> classes
>> in that assembly and call whatever methods you like.
>
>



Jul 21 '05 #9

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

Similar topics

6
by: Jon | last post by:
I have 3 VB.net executables that reference the same 3 VB.Net DLLs. How is the best way to distribute the EXEs without putting 3 copies of of DLL on a user's machine. I looked into Private...
1
by: James | last post by:
I'm having a problem using the System.Net.WebClient to download .exes from a web server. I'm testing everything on localhost, and the same code works fine with all other types of file. I even tried...
8
by: Dave | last post by:
This may be a simple question, but I'm new to .NET and not having much luck finding out the answer. I'm writing a Windows Service and want to develop a separate program that provides a user...
1
by: shan | last post by:
hi i have a problem i have one windows service which i am installing from one other exe(in process.start simply using cmd.exe and installutil) now i want to combine these both exes into one for...
0
by: VanL | last post by:
I will be presenting a talk at PyCon, "The Absolute Minimum an Open Source Developer Needs to Know About Intellectual Property." I want to tailor this talk so that it is interesting to as many...
0
by: banderson777 | last post by:
Hello, I'm a bit new at in-depth IE programming, and am having a bit of trouble with a couple of IE browser extensions (getting them to talk to each other). The first one is a C++ Browser Helper...
5
by: ajay | last post by:
Hi All, I want to build two separate EXEs using one .dsw file. That dsw file will load two different DSPs for two different projects. One project would use gcc cross compiler but other project...
1
by: pavanip | last post by:
Hi, I have one windows application in that i created multiple exes.Now I am trying to build my application and combine multiple exes to one exe.But i am unable to that can you tell me the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.