PC Review


Reply
Thread Tools Rate Thread

Adding Service References

 
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      11th Aug 2009
Hi,

I'm trying to add a service reference to a client project (using the "Add
Service Reference" menu in the solution explorer).

I use VS2008 and dotnet 3,5 and the "WCF Service Configuration Editor"
software to setup the service project.

I have a project with two WCF endpoints (TCP and HTTP).
Then i have another project (the client) where i want to add the service
reference (the reference to my WCF enpoint(s)).

The only way i can make this works, is if i add a HTTP endpoint and setting
httpGetEnabled to true.
If i remove the HTTP endpoint from my service project (or set httpGetEnabled
to false), the client is not able to browse the service in the "Add Service
Reference" option.

My question is, how do i browse and add the service reference to my client,
if the service only have one TCP endpoint ??

Thank you in advance.
BR
Peter


 
Reply With Quote
 
 
 
 
Colbert Zhou [MSFT]
Guest
Posts: n/a
 
      12th Aug 2009
Hello Peter,

To make Visual Studio's Add Reference Service find the WCF service, we need
to expose the corresponding mex endpoint for that WCF service. Otherwise,
ARS dialog will not find it. The mex endpoint is supposed to provide mete
data exchange to make it visible.

See the following two links,
http://social.msdn.microsoft.com/For...fc5-4cd9-4901-
a2c3-ccf9e95b6588
http://alexpinsker.blogspot.com/2009...-for-nettcp.ht
ml

If you have any future questions or concerns on this, please feel free to
let me know!

Have a nice day, Sir!


Best regards,
Colbert Zhou
Microsoft Online Support Team

 
Reply With Quote
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      12th Aug 2009
Hi Colbert,

Thanks for the reply.

So what you say is this: if i don't add a http endpoint, i must add a
mexTcpBinding endpoint instead (that is if i want ASR to work), right ??
Do i need to create a new service behavior configuration/element for each
endpoint i have or is it ok to add a service behavior to more than one
endpoint ??

BR
Peter



"Colbert Zhou [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Peter,
>
> To make Visual Studio's Add Reference Service find the WCF service, we
> need



 
Reply With Quote
 
Colbert Zhou [MSFT]
Guest
Posts: n/a
 
      14th Aug 2009
>>So what you say is this: if i don't add a http endpoint, i must add a
mexTcpBinding endpoint instead (that is if i want ASR to work), right ??

Yes.

>>Do i need to create a new service behavior configuration/element for each

endpoint i have or is it ok to add a service behavior to more than one
endpoint ??

We do not need to add another new service behavior. It is OK to map one
service behavior to more than one endpoint.

Actually the following is test in my side.
In the app.config,
---------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.MetadataBehavior">
<serviceMetadata httpGetEnabled ="false " httpsGetEnabled ="false
" />
</behavior>
</serviceBehaviors>
</behaviors>

<services>
<service name="WcfService1.Service1"
behaviorConfiguration="WcfService1.MetadataBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:5555/WcfService1"/>
</baseAddresses>
</host>
<!-- Endpoint for the service. -->
<endpoint address="service" binding="netTcpBinding"
contract="WcfService1.IService1" />
<!-- Metadata endpoint. -->
<endpoint address="mex" binding="mexTcpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
-----------------------------------------------------

And we need to write the following codes to start it,
---------------------------------
static void Main(string[] args)
{
ServiceHost serviceHost = new
ServiceHost(typeof(WcfService1.Service1));
serviceHost.Open();
while (true)
{
}
}
----------------------------------

After the above application starts it start the WCF service. So I can find
this WCF service in Add Service Reference in the Visual Studio from my test
client.


Best regards,
Colbert Zhou
Microsoft Online Support Team

 
Reply With Quote
 
Peter Larsen [CPH]
Guest
Posts: n/a
 
      14th Aug 2009
Thanks for your time Colbert :-)


"Colbert Zhou [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding references as VB does. Mr. X. Microsoft C# .NET 1 13th Jul 2010 10:21 AM
adding References of References Relaxin Microsoft Dot NET 2 22nd Feb 2008 01:20 PM
Adding References using VBA =?Utf-8?B?dnF0aG9tZg==?= Microsoft Excel Programming 1 23rd Jul 2007 03:24 PM
references adding themselves based on references from other projects referenced Brian Henry Microsoft VB .NET 1 22nd Jul 2005 06:35 PM
adding references =?Utf-8?B?SmFnYWRpc2g=?= Microsoft Excel Programming 2 25th Oct 2004 03:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 AM.