Host WCF in a Windows Service Using TCP
I'm trying to host a wcf service (tcp) in a windows service on Windows 2008 x64.
I first made a normal program as host and that works fine.
I then made a windows service with the same config:
http://msdn.microsoft.com/en-us/library/ff649818.aspxThe server installed fine en starts without a problem, but I can't connect to it.
I think the program isn't loading the config file (exename.config) because myServiceHost.BaseAddresses is empty.Any idea what could cause this or how I can find the error?
Here is my config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="SlmWcfServiceLibrary.Service1Behavior" name="SlmWcfServiceLibrary.SlmService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="" contract="SlmWcfServiceLibrary.ISlmService">
<identity>
<dns value="localhost" />
</identity>
</endpoint&g开发者_运维问答t;
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9999/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SlmWcfServiceLibrary.Service1Behavior">
<serviceMetadata httpGetEnabled="False" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup></startup>
</configuration>
精彩评论