Remote access to a Nancy Self Host

后端 未结 3 1956
别跟我提以往
别跟我提以往 2020-12-09 04:58

I am creating a Nancy Module that will eventually be hosted inside of a Windows Service. I am currently running it inside of a WPF test application. To start the Nancy hos

相关标签:
3条回答
  • Windows will prevent you from listening on ports without permission. You can either run your process as administrator, or add permission using "netsh":

    netsh http add urlacl url=http://+:8080/app user=domain\user

    The "+" is a wildcard so it can listen on any IP.

    Normally you'd handle the latter during installation, so you may want to run as admin to debug, then make sure your installer sets the relevant permissions.

    0 讨论(0)
  • 2020-12-09 05:21

    For local debugging, use

    http://+:8733/Design_Time_Addresses
    

    You can add any subdirectory you like, for example

    http://+:8733/Design_Time_Addresses/myService 
    

    and debug it at

    http://localhost:8733/Design_Time_Addresses/myService
    

    without running your IDE (Visual Studio?) as Administrator.

    0 讨论(0)
  • 2020-12-09 05:24

    Look this: Self-Hosting-Nancy

    The Host Configuration: UrlReservations, add under code:

    var configuration = new HostConfiguration
            {
                UrlReservations = new UrlReservations { CreateAutomatically = true }
            };
    

    OK, you can create your host!~

    0 讨论(0)
提交回复
热议问题