huysentruitw / print-it

Windows service for printing PDF files to a local or network printer in the background
MIT License
84 stars 43 forks source link

Can't get a response from the running registered service with Postman #9

Closed dgwaldo closed 3 years ago

dgwaldo commented 3 years ago

I think I did have the service registered and running correctly before, but I was trying to use postman and a web browser to check that I'd set things up correctly. Now I can see the port is listening with Netstat, but still get 404's when trying to add printers or list them using postman.

I've tried several things... Everything returns a 404 GET http://127.0.0.1:7001/api/printers/list http://localhost:7001/api/printers/list

POST http://127.0.0.1:7001/api/printers/install?printerPath=\\printserver\DDG1

Any ideas on what could be going on here? A coworker is having the same issues...

huysentruitw commented 3 years ago

Quick check: did you manually change the port to 7001 in appsettings.json, because the default port is set to 7000.

dgwaldo commented 3 years ago

Yes I did change the port. Trying everything I can think of...

dgwaldo commented 3 years ago

Deleted any services I'd created, cleared everything. Reinstalled.

C:\WINDOWS\system32>netstat -a | find ":7000" TCP 127.0.0.1:7000 LAPTOP-272:0 LISTENING TCP [::1]:7000 LAPTOP-272:0 LISTENING

That looks great. However, using Postman still get a 404... I'd love to figure this out :)

dgwaldo commented 3 years ago

Installed this on another PC, (home machine) ensuring there isn't some GP or other work env setting. Same result, just get a 404 from Postman. What am I missing?

dgwaldo commented 3 years ago

I've added in a WebHost using ASP.NET Core, and served the app that way. Doing that works fine, but the service never seems to work. Debugging the code, I can never hit a route when using the service.

dgwaldo commented 3 years ago

Found the issue. I was too trusting of the documentation :) Finally noticed that the routes out of the service do not start with api/ as is common when using ASP.Net for hosting. I've branched fixed that, and added in a web project for hosting.

huysentruitw commented 3 years ago

Sorry for the late reply to this, but it has been a busy week. We can't change the routes as external parties already depend on it, so I will fix the README instead.

Also adding an additional ASP.NET Core project will make things confusing. This was just a matter of wrong documentation 😀