6 Months Free & No Setup Fees ASP.NET Hosting!
Skip Navigation Links
C# Corner Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » WCF » How to define Endpoints for multiple service contracts(interfaces) implemented in separate classes ?
       
Author Reply
padmavathi gudipati
posted 11 posts
since Jul 14, 2010 
from

How to define Endpoints for multiple service contracts(interfaces) implemented in separate classes ?

  Posted on: 26 Aug 2010       

Hi
I have taken a WCFService library in which I have defined multipled service contracts(interfaces) in separate cs files and implemented them separately. For example ..
[ServiceContract]
public interface IService1
{
 [OperationContract]
  string GetService1Msg();
}
[ServiceContract]
public interface IService2
{
 [OperationContract]
 string GetService2Msg();
}
I have defined above interfaces in separate cs files.
Now I have implemented them separately as follows.

//this is Service1.cs file
public class Service1 : IService1
{
  string GetService1Msg()
  { 
     retutn "Service1";
  }
}
//this is Service2.cs file
public class Service2 : IService2
{
  string GetService2Msg()
  { 
     retutn "Service2";
  }
}
My intention here is to expose above two as two service contracts/interfaces outside.
Now My question is how to define endpoints for these two service interfaces in app.config of this WCF Servicelibrary?
Thanks in advance
Padma
 
padmavathi gudipati
posted  11 posts
since  Jul 14, 2010 
from 

 Re: How to define Endpoints for multiple service contracts(interfaces) implemented in separate classes ?
  Posted on: 26 Aug 2010        0  

My app.config file goes this way:<services>
<
service behaviorConfiguration="DataModelService.Service1Behavior"
name="DataModelService.Service1">
<
endpoint address="" binding="netTcpBinding" contract="DataModelService.IService1">
<
identity>
<
dns value="localhost" />
</
identity>
</
endpoint>
<
endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<
host>
<
baseAddresses>
<
add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/DataModelService/Service1/" />
</
baseAddresses>
</
host>
</
service>
<
service behaviorConfiguration="DataModelService.Service1Behavior"
name="NebulaDataModelService.Service2">
<
endpoint address=""
binding="netTcpBinding"
contract="DataModelService.IService2">
<
identity>
<
dns value="localhost"/>
</
identity>
</
endpoint>
<
endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
<
host>
<
baseAddresses>
<
add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/DataModelService/Service1/"/>
</
baseAddresses>
</
host>
</
service>
</
services>
<behaviors>
<
serviceBehaviors>
<
behavior name="DataModelService.Service1Behavior">
<!--
To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment
-->
<
serviceMetadata httpGetEnabled="False"/>
<!--
To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information
-->
<
serviceDebug includeExceptionDetailInFaults="true" />
</
behavior>
<
behavior name="DataModelService.Service2Behavior">
<
serviceMetadata httpGetEnabled="true"/>
<
serviceDebug includeExceptionDetailInFaults="true"/>
</
behavior>

</
serviceBehaviors>
</
behaviors>
.....
 
 
But when I run the TestWCF client for this I am getting error saying Channel is already registered.
Is this due to same base address given for both the services?
Can two service share the common baseaddress? If so can anyone help me out how can i do this?
Thanks & Regards
Padma
 
 
Krish K
posted  1 posts
since  Sep 09, 2010 
from 

 Re: How to define Endpoints for multiple service contracts(interfaces) implemented in separate classes ?
  Posted on: 09 Sep 2010        0  

Hi
I am using 2 services ( 1 service with Interfaces and another is 1 service) in my applications. I have no issues.. Below is my config file looks like below
<
services>
<
service behaviorConfiguration="Aspire_LINQ_SQL.Web.Aspire_WCFBehavior"
name="Aspire_LINQ_SQL.Web.Aspire_WCF">
<
endpoint address="" binding="customBinding" contract="Aspire_LINQ_SQL.Web.IAspire_WCF">
<
identity>
<
dns value="localhost" />
</
identity>
</
endpoint>
<
endpoint address="" binding="customBinding" contract="Aspire_LINQ_SQL.Web.IAspire_Admin">
<
identity>
<
dns value="localhost" />
</
identity>
</
endpoint>
<
endpoint address="" binding="customBinding" contract="Aspire_LINQ_SQL.Web.IAspire_FTR">
<
identity>
<
dns value="localhost" />
</
identity>
</
endpoint>
<
endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</
service>
<
service behaviorConfiguration="Aspire_LINQ_SQL.Web.silverlight_WCFBehavior"
name="Aspire_LINQ_SQL.Web.silverlight_WCF">
<
endpoint address="" binding="customBinding" bindingConfiguration="customBinding1"
contract="Aspire_LINQ_SQL.Web.IAspire_OECReports" />
<
endpoint address="" binding="customBinding" bindingConfiguration="customBinding1"
contract="Aspire_LINQ_SQL.Web.IAspire_Admin" />
<
endpoint address="" binding="customBinding" bindingConfiguration="customBinding1"
contract="Aspire_LINQ_SQL.Web.IAspire_FTR" />
<
endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</
service>
<
service behaviorConfiguration="Aspire_LINQ_SQL.Web.OECReportBehavior"
name="Aspire_LINQ_SQL.Web.OECReport">
<
endpoint address="" binding="wsHttpBinding" contract="Aspire_LINQ_SQL.Web.IOECReport">
<
identity>
<
dns value="localhost" />
</
identity>
</
endpoint>
<
endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</
service>

<
service behaviorConfiguration="Aspire_LINQ_SQL.Web.OECReport_SerBehavior"
name="Aspire_LINQ_SQL.Web.OECReport_Ser">
<
endpoint address="" binding="customBinding" bindingConfiguration="customBinding4"
contract="Aspire_LINQ_SQL.Web.OECReport_Ser" />
<
endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

</
service>
</
services>
       
6 Months Free & No Setup Fees ASP.NET Hosting!
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Discover the top 5 tips for understanding .NET Interop
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
Team Foundation Server Hosting
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved