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
Loading
Krish KPosted Sep 9, 2010, 11:07 AM
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>
padmavathi gudipatiPosted Aug 26, 2010, 3:53 AM
<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">
<serviceMetadata httpGetEnabled="False"/>
<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