Hi All
I am currently having an issue calling a WCF service from a windows service. My Application Solution looks like this.
- Web Administration Console (Web Project)
- Central Control (Windows Service)
- WCF service so the Web Administration Console can connect to it and configure it
- Several Calls to use WCF on the Node (Window Service)
- Node (Windows Service)
- WCF service to allow the Central Control Windows service configure it
The Web Administration Console can access the Central Control WCF but the Central Control Times Out when ever it tries to connect to the Node. In testing this I created a Launcher app which is a simple Windows Form Project which creates an instance of each service and has a couple of buttons which use a WCF function in each of the windows services (just to see what was failing) this Launcher app couldn’t speak to either of the Windows Services. This was confused me so I added the same buttons to a Web Form in the Web Administration Console and it connected to both Windows Services perfectly through WCF. I know the WCF stuff is working as I can hit it through IE and see all of the wonderful XML (and obviously the fact that the calls work from the web app are a good indication of it being up and running)
In short My web apps can use the WCF services in my Windows Services but Windows Forms and Windows services cannot. Why is this!?
I have pretty much already run out of time on this project so speedy replies would be awesome!
Tech/Code details I am not using config files in the applications. Everything is being created through code and I have been using the same code to make my WCF calls every where. Also I have tried to turn security off everywhere in case that was the issue. Also I am using the same svcutil generated proxy files everywhere as well to keep it all consistent
Example of a call to the Node
Dim Bind As New WSHttpBinding(SecurityMode.None, True)
Bind.CloseTimeout = New TimeSpan(0, 0, 10)
Bind.OpenTimeout = New TimeSpan(0, 0, 10)
Bind.SendTimeout = New TimeSpan(0, 0, 10)
Dim client As New BN.BNodeServiceClient(Bind, New EndpointAddress("http://localhost:27374/Node"))
client.sendMessage("Test Message")
client.Close()
The Node opening its WCF
BNodeHost = New ServiceHost(GetType(iBNodeService))
BNodeHost.AddServiceEndpoint(GetType(BNodeService), New WSHttpBinding(SecurityMode.None, True), New Uri("http://localhost:27374/Node"))
Dim metadataBehavior As ServiceModel.Description.ServiceMetadataBehavior
metadataBehavior = BNodeHost.Description.Behaviors.Find(Of _
ServiceModel.Description.ServiceMetadataBehavior)()
If metadataBehavior Is Nothing Then
metadataBehavior = New ServiceModel.Description.ServiceMetadataBehavior()
metadataBehavior.HttpGetEnabled = True
metadataBehavior.HttpGetUrl = New Uri("http://localhost:27374/Node")
BNodeHost.Description.Behaviors.Add(metadataBehavior)
Else
BNodeHost.Description.Behaviors.Add(metadataBehavior)
End If
BNodeHost.Open()
This was all working before I made the different bits proper Windows Services and tried to add installers to it. The installers work fine and install the services which start and allow me to see all the WCF XML in IE.
As you might be able to tell, I am very new to WCF and this is my first application using it. The fundamental bits have been pretty much Copy/Paste/Alter jobs from a sample that doesn’t use config files.
Any help would be greatly appreciated. Thanks in advance,
Matt