I have a WCF service contract, which is basically a subscriber publishing template.
The WCF service is hosted inside the Windows service from which I want to publish. Clients subscribe to messages and when Windows Service does something that it publishes to all clients.
To host the service, I declared the ServiceHost class, and the contract class has a method that is not marked in the interface, but implemented in the class for publication.
I want this method to be called locally (not through WCF), which then posts the message through Callbacks.
I can't seem to get a contract class instance from ServiceHost.
Is this possible, and if so, how? I know that the work around is to have the client embedded in the service, but it seems a bit strange creating a client to connect to itself.
Thanks in advance
DJIDave
app.config
<system.serviceModel> <services> <service behaviorConfiguration="Processor.Wcf.ServiceBehavior" name="Processor.Wcf.ProcessorService"> <endpoint address="net.tcp://localhost:9000/processor/service" binding="netTcpBinding" name="procService" bindingConfiguration="netTcpBindingConfig" contract="Processor.Wcf.IProcessorService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8732/Design_Time_Addresses/Processor.Wcf/Service1/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="Processor.Wcf.ServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <netTcpBinding> <binding name="netTcpBindingConfig" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Transport"> <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /> </security> </binding> </netTcpBinding> </bindings> </system.serviceModel>
DJIDave
source share