Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WCF: How to reference a service that runs in the same process?

1 view
Skip to first unread message

Steve B.

unread,
Oct 19, 2006, 4:02:47 AM10/19/06
to
Hi,

I'm building a service that can act both client and server (two servers can
communicate each others).

How can I set my project in order to create the service reference ?

thanks,
Steve


Arkady Frenkel

unread,
Oct 19, 2006, 5:46:48 AM10/19/06
to
If you mean, that you want to communicate from one service with another, you
can use proxy exactly as client or create channel to second service's entry
point directly :
channelFactory = new ChannelFactory<YouSecondServiceInterface>(binding,
address);

YouSecondServiceInterface channel = channelFactory.CreateChannel();

Arkady

"Steve B." <steve_...@com.msn_swap_msn_and_com> wrote in message
news:e0JW4T18...@TK2MSFTNGP03.phx.gbl...

Steve B.

unread,
Oct 19, 2006, 6:10:07 AM10/19/06
to
Let's expose the scenario...

I want to build a service that runs on multiple serveurs. These services can
send data to other instances of the service on other computer.

The sent data is selected by an administrator in a windows app.

We have :

Admin computer : run a windows app which is client of "SourceService"
Server A : run a host which is client of "DestinationService" and host
"DestinationService" and "SourceService"
Server B : run a host which is client of "DestinationService" and host
"DestinationService" and "SourceService"

The source service have a method like : SendData(Data myData, string
remoteServer)
The destination service have a methode like : ReceiveData(Data myDate);

Inside this method, I have something like this:

string remote = BuildUri(uriFormat, remoteserver); // build the correct
remote uri

DestinationServiceClient proxy = new DestinationServiceClient(remote);

proxy.ReceiveData(Data myData);


However, the last line "proxy.ReveiveData" throw an exception 400: bad
request.

I also try this code :
IDestination destProxy = ChannelFactory<IDestination>.CreateChannel(

new WSHttpBinding(),

new EndpointAddress(remoteUri)

);

destProxy.ReceiveData(myData);

But I get the same behaviour...

"Arkady Frenkel" <ark...@hotmailxdotx.com> a écrit dans le message de news:
OSjzAO28...@TK2MSFTNGP03.phx.gbl...

Arkady Frenkel

unread,
Oct 19, 2006, 8:24:16 AM10/19/06
to
That exact scenario of router example from
http://windowssdk.msdn.microsoft.com/en-us/library/ms751497(VS.80).aspx
I prefer second way - direct channel without proxy because both sides know
each other in my case
Arkady


"Steve B." <steve_...@com.msn_swap_msn_and_com> wrote in message

news:%23geTCb2...@TK2MSFTNGP03.phx.gbl...

0 new messages