I'm setting up a service to run the server for a WCF rather then IIS, and have my server app:
static void Main(){
ServiceHostm myServicHost = new ServiceHost( typeof(WcfPortal), new Uri("net.tcp://localhost:8001"));myServicHost.Open();
Application.Run(new Form1());myServicHost.Close();
}
the referces added are my library of BOs and CSLA
and my app config is:
<
configuration><
system.serviceModel><
services><
service name = "WcfPortal"><
endpoint address = "net.tcp://localhost:8001" binding = "netTcpBinding" contract = "Csla.Server.Hosts.IWcfPortal"/>
</
service></
services></
system.serviceModel></
configuration>I'm getting "Service 'Csla.Server.Hosts.WcfPortal' has zero application (non-infrastructure) endpoints."
I feel I'm missing something, such as net.tcp://localhostL8001/????? but not sure what.
The http version I've got wors well, but is slow, as based on my own nonCSLA testing WCF where you can use netTCP appears to be 5times faster.....
Thanks Tony
Hi,
Yes, you're missing the endpoint name. The correct address is a valid URI like this: net.tcp://localhost:8001/MyWcfService
Just make this change in the URI and address in the configuration file and should be fine...
Regards,
George B
Thanks - I see the interface is the key here, not the uri, as long as both the client/server have the same url referece? OK... so I've got past this error now, but when I call the DataPortal (in this case to setup my security):
"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://ws.lhotka.net/WcfDataPortal:FetchResult. The InnerException message was ''Element' '_fieldManager' from namespace 'http://schemas.datacontract.org/2004/07/Csla' is not expected. Expecting element '_serializableChangedHandlers'.'. Please see InnerException for more details."
I'm thinking as both the client and server is using the same interface, the the 'joy' of WCF means tha the pmumbing is automatic (as long as the interface IS the same)........ mmmm - Ah!
I re-added references to CSLA, and bingo!! I'm away... thanks for pointing out the obvious - wcf light has just gone on! (I'm so used to the webservce,iis,soap stuff).
Thanks Tony
I'm also trying to get this to work with netTcpBinding with a console app as my host:
Here's my config:
<system.serviceModel>
<services>
<service name="Csla.Server.Hosts.WcfPortal">
<endpoint address="net.tcp://localhost:7001/WcfPortal" binding="netTcpBinding"
bindingConfiguration="" contract="Csla.Server.Hosts.IWcfPortal" />
</service>
</services>
</system.serviceModel>
Here's my hosting code:
Dim host As New ServiceModel.ServiceHost(GetType(Csla.Server.Hosts.WcfPortal))
host.Open()
For Each ep In host.Description.Endpoints
Console.WriteLine(ep.Address)
Next
Console.WriteLine("The service is hosted. Press any key to exit")
Resolved it with the following serviceModel config:
<services>
<service behaviorConfiguration="returnFaults" name="Csla.Server.Hosts.WcfPortal">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:7001/WCFDataPortal"/>
</baseAddresses>
</host>
<endpoint binding="netTcpBinding"
bindingConfiguration="netTcpBinding_IWcfPortal"
contract="Csla.Server.Hosts.IWcfPortal" />
<endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"
bindingConfiguration="mexTcp" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding_IWcfPortal" maxReceivedMessageSize="2147483647" portSharingEnabled="true">
<readerQuotas maxDepth="1024" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
<security mode="None" />
</binding>
<binding name="mexTcp" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
Copyright (c) Marimer LLC