Hosting a WCF Service Lib through a Windows service get a System.InvalidOperationException: attempti
- by JohnL
I have a WCF Service Library containing five service contracts. The library is hosted through a Windows Service. Most if not all my configuration for the WCF Library is declaritive. The only thing I am doing in code for configuration is to pass the type of the class implementing the service contracts into ServiceHost. I then call Open on each of the services during the Windows Service OnStart event. Here is the error message I get:
Service cannot be started. System.InvalidOperationException: Service '[Fubu.Conversion.Service1' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
at System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreNonMexEndpoints(ServiceDescription description)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnBeginOpen()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Fubu.RemotingHost.RemotingHost.StartServ...
protected override void OnStart(string[] args)
{
// Uncomment to debug this properly
//System.Diagnostics.Debugger.Break();
StartService1();
StartService2();
StartService3();
StartService4();
StartService5();
}
Each of the above simply do the following:
private void StartSecurityService()
{
host = new ServiceHost(typeof(Service1));
host.Open();
}
Service Lib app.congfig summary
<services>
<service behaviorConfiguration="DefaultServiceBehavior" name="Fubu.Conversion.Service1">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="TCPBindingConfig"
name="Service1" bindingName="TCPEndPoint" contract="Fubu.Conversion.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="mexSecurity" bindingName="TcpMetaData" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8025/Fubu/Conversion/Service1/" />
</baseAddresses>
</host>
</service>
...
Contract is set up as follows:
namespace Fubu.Conversion.Service1
{
[ServiceContract(Namespace = "net.tcp://localhost:8025/Fubu")]
public interface IService1
{
I have looked "high and low" for a solution without any luck. Is the answer obvious? The solution to this does not appear to be. Thanks