Hello, I recently created a WCF service (dll) and a service host (exe). I know my WCF service is working correctly since I am able to successfully add the service to WcfTestClient. However, I seem to be running into an issue when I comes to utlizing my WCF from a service host (exe). I can add a reference to the WCF (dll) to my service host (exe) and create the necessary componets to the exe; such as the service installer, service host, and the app.config, compile and then finally install the exe using InstallUtil. But, when I tried to start the service in the Microsoft Management Console, the service immediately stops after being started. So I began investigating what could exactly be causing this issue an came up with this error from the Application Log in the Event Viewer. Description:
Service cannot be started. System.InvalidOperationException: Service 'Service' 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.
This error is actually generated in the OnStart; of my exe, when I perform this call ServiceHost.Open(). I've seen numerous posts where other individuals have run into this issue, however most if not all of them, claim that the service name or contract; namespace and class name, are not being specified. I checked both of these entries in my config file; in the exe as well as in the dll, and they match up PERFECTLY. I've had other people in the office double check behind me to make sure I wasn't going blind at one point, but of course they came to the same conclusion as me that everything looked like it was specified correctly. I am truly at a lost as to what is going on at this point. Could anyone help me with this issue?
Another thing that came up as a possible reason this may be happening is that the app.config is never being read; at least not the one I think should be getting read. Could this be the issue? If so, how can I go about addressing this issue. Again, ANY help would be appreciated.
Loading
A DPosted Feb 25, 2010, 8:46 AM
namespace: Test
Service: Service1
full service name in the service tag of the app.config is "Test.Service1"
contract: IService1
full contract name in the endpoint tag of the app.config is "Test.IService1"
The Assembly Name for the service (dll) is "Test.Services"
The default namespace is "Test"
I don't see why things are not working?
Here is the App.config used by the service (dll); the only difference in the config and the one used by the service host (exe) is that there is not mention of the Enterprise Library tags. Those tags point to an external config; by the way I have already stripped those tags out before to make sure they were not causing the error but still had no success.
xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
configSections>
<system.web>
<compilation debug="true" />
system.web>
<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources>
<add name="File Configuration Source"
filePath="C:\Program Files\Test\Config\Test.config" />
sources>
enterpriseLibrary.ConfigurationSource>
<system.serviceModel>
<services>
<service name="Test.Service1"
behaviorConfiguration="TestServiceBehavior">
<host>
<baseAddresses>
<add baseAddress = "net.tcp://localhost:9000/TestServices/TestService" />
baseAddresses>
host>
<endpoint address =""
binding="netTcpBinding"
contract="Test.IService1">
<identity>
<dns value="localhost"/>
identity>
endpoint>
<endpoint address="mex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
service>
services>
<extensions>
<behaviorExtensions>
<add name="validation"
type="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF.ValidationElement, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
behaviorExtensions>
extensions>
<behaviors>
<serviceBehaviors>
<behavior name=" TestServiceBehavior ">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
behavior>
serviceBehaviors>
<endpointBehaviors>
<behavior name="ValidationBehavior">
<validation enabled="true" ruleset="RuleSetA" />
behavior>
endpointBehaviors>
behaviors>
system.serviceModel>
configuration>
Any ideas what could be wrong?
Sam HobbsPosted Feb 25, 2010, 12:31 AM