I haven't heard a way in UWP which can host a service with a URL. UWP technology can consume app service, but it cannot create a URL. UWP can also consume WCF service, but it seems you cannot make ServiceHost work as expected( can you explain more about this part? If app service can help you achieve your job, I recommend that you can use app service directly instead of webservice).
So finally what I can think about is to handle network communications in background with the help from backgroundtask and related triggers. Please have a look at the following doc:
Network communications in the background
In short, as the doc has mentioned, it's the following:
"Apps use background tasks and two main mechanisms to maintain communications when they are not in the foreground: The socket broker, and control channel triggers. Apps that use sockets for long-term connections can delegate ownership of a socket to a system socket broker when they leave the foreground. The broker then activates the app when traffic arrives on the socket, transfers ownership back to the app, and the app processes the arriving traffic."
There are some samples which may helpful to you but you need to choose the appropriate sample by your own scenario:
SocketActivityStreamSocket sample
ControlChannelTrigger StreamWebSocket sample
ControlChannelTrigger HttpClient sample