Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

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

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 10-19-2006   #1 (permalink)
Steve B.
Guest


 

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

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



My System SpecsSystem Spec
Old 10-19-2006   #2 (permalink)
Arkady Frenkel
Guest


 

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

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_beauge@com.msn_swap_msn_and_com> wrote in message
news:e0JW4T18GHA.4304@TK2MSFTNGP03.phx.gbl...
> 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
>



My System SpecsSystem Spec
Old 10-19-2006   #3 (permalink)
Steve B.
Guest


 

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

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" <arkadyf@hotmailxdotx.com> a écrit dans le message de news:
OSjzAO28GHA.4996@TK2MSFTNGP03.phx.gbl...
> 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_beauge@com.msn_swap_msn_and_com> wrote in message
> news:e0JW4T18GHA.4304@TK2MSFTNGP03.phx.gbl...
>> 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
>>

>
>



My System SpecsSystem Spec
Old 10-19-2006   #4 (permalink)
Arkady Frenkel
Guest


 

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

That exact scenario of router example from
http://windowssdk.msdn.microsoft.com...97(VS.80).aspx
I prefer second way - direct channel without proxy because both sides know
each other in my case
Arkady


"Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
news:%23geTCb28GHA.4604@TK2MSFTNGP03.phx.gbl...
> 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" <arkadyf@hotmailxdotx.com> a écrit dans le message de
> news: OSjzAO28GHA.4996@TK2MSFTNGP03.phx.gbl...
>> 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_beauge@com.msn_swap_msn_and_com> wrote in message
>> news:e0JW4T18GHA.4304@TK2MSFTNGP03.phx.gbl...
>>> 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
>>>

>>
>>

>
>



My System SpecsSystem Spec
 

Thread Tools
Display Modes




Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51