I'm writing a web application that will be hosted in Electron on a Raspberry PI. The Raspberry PI has a fingerprint scanner attached which returns me a string that I need to check if the fingerprint is registered in my Database on another server. I'm doing this by invoking a WCF Service Method hosted on the network.
Now the problem is when calling the WCF Service I get a timeout after 1 Minute (default timeout) but it works when I'm running the application on my local machine.
Service Code:
[ServiceContract(Namespace = "http://192.168.0.154:8733/GlauxSoft.SnackBox.WebService/")]
public interface IService
{
[OperationContract]
Fingerprint GetFingerprintByUniqueId(string uniqueId);
}
public class Service : IService
{
public Fingerprint GetFingerprintByUniqueId(string uniqueId)
{
// This is just a DataBase call, nothing extraordinarily expensive
using (EvidenceSessionHelper.CreateDefaultWebServiceSession())
{
return Fingerprint.MapAuthentifizierungToWebServiceFingerprint(QueryAuthentifizierung.GetFingerprintByUniqueId(uniqueId));
}
}
}
Consumer Code:
[ServiceContract(Namespace = "http://192.168.0.154:8733/GlauxSoft.SnackBox.WebService/", ConfigurationName = "ISnackBoxService")]
public interface ISnackBoxService
{
[OperationContract(
Action ="http://192.168.0.154:8733/GlauxSoft.SnackBox.WebService/IService/GetFingerprintByUniqueId",
ReplyAction = "http://192.168.0.154:8733/GlauxSoft.SnackBox.WebService/IService/GetFingerprintByUniqueIdResponse")]
Fingerprint GetFingerprintByUniqueId(string uniqueId);
}
public class ServiceClient : ClientBase<IService>, IService
{
public SnackBoxServiceClient() :
base(GetDefaultBinding(), GetDefaultEndpointAddress())
{
Endpoint.Name = EndpointConfiguration.BasicHttpBinding_ISnackBoxService.ToString();
}
public enum EndpointConfiguration
{
BasicHttpBinding_ISnackBoxService
}
public Fingerprint GetFingerprintByUniqueId(string uniqueId)
{
return Channel.GetFingerprintByUniqueId(uniqueId);
}
}
The consumer is a ASP.NET Razor app written in .NET Core 3 Preview 5
And I'm calling the Consumer code like so:
var service = new ServiceClient();
var evdFingerprint = service.GetFingerprintByUniqueId("Test String"); // <-- Runs for 1 minute and throws the TimeoutException
Here is the stack trace:
System.TimeoutException: The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'http://192.168.0.154:8733/GlauxSoft.SnackBox.WebService/' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. at System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.SendRequestAsync(Message message, TimeoutHelper timeoutHelper) at System.ServiceModel.Channels.RequestChannel.RequestAsync(Message message, TimeSpan timeout)
Edit: I've done some further testing, it seems like any HTTP request to my local machine isn't getting through as doing wget 192.168.0.154:5106 -o index.html
and monitoring my network traffic with wireshark isn't showing me any GET requests to my pc and going to https://192.168.0.154:5106
times out as well.
I am however able to ping my local pc and I can even SSH into my Raspberry PI and I can also establish a VNC Remote Desktop session with my Raspberry PI
The fix was simple enough, I needed to use HTTPS, so instead of connecting to http://192.168.0.154:8733/...
I needed to connect to https://192.168.0.154:8733/...