locked
Create windows Service that listens in different ports. RRS feed

  • Question

  • User-1868956463 posted

    Hi all, I need some advice for the following issue.

    I have three projects,
        1. UI project (4.6.2 framework)
        2. Messaging project (core 3.1 framework)     (Contains REST API and SignalR project)
        3. BatchProcess Project

    The Messaging project will be running as a windows service. I need the signalR project to listen to port, say, 7000 and REST API to run on port 7500.

    my flow is somewhat like this. From UI I will connect to SignlaR, in response I wll get the connectionId. Then I call the batch process sending the connectionId as a  parameter.  The Batch process run for a while and call the REST API in Messaging project with connectionId. This API will inturn calls the signalr hub class and sends the messages to the respective client.


      How should I create a windows service in .net core that listens in two different ports. suggest me or plz provide me a link. 

    Kindly suggest. 

    Friday, September 11, 2020 10:05 PM

All replies

  • User1120430333 posted

    Of course the REST API and SignalR are Web solutions that are  hosted by a Web server that I know about.  I dont see how a Windows service  running on the Windows desktop is supposed to be sitting there  listening on any port, since it cannot host Web applications

    Maybe, I am missing something. 

    Saturday, September 12, 2020 10:22 AM
  • User-474980206 posted

    Why do you want two different ports? As asp.net core apps are command line apps, it’s each to convert to a service, but why not just use iis?

    Saturday, September 12, 2020 3:02 PM
  • User585649674 posted

    I guess you do not want client - server model. And you are trying to install all the application in each of the client.

    Signal r is needed only when server needs to contact client. Otherwise you could do a polling mechanism by calling the server at regular intervals.

    Signalr and api needs to be installed separately and should be run on separate port.

    Please check if you can try

    localhost:7000/api

    localhost:7000/signalr

    Monday, September 14, 2020 8:37 AM