1. Alex Riofrio
  2. PowerServer
  3. Friday, 17 June 2022 16:24 PM UTC

Hi all;

Please your help with this situation.

I created an executable for a PowerServer 2021 Web API (using the Publish tool in SnapDevelop). In the project I have indicated that the "Web API URL" uses a port other than 5000; but when running the Web API (since the executable file) it always runs on port 5000 by default.
Do you know what the steps would be to create another profile or force the executable to use another port?

Thanks in advance.

Alex

Accepted Answer
Alex Riofrio Accepted Answer Pending Moderation
  1. Saturday, 18 June 2022 15:04 PM UTC
  2. PowerServer
  3. # Permalink

Exploring on the topic I found:

- LaunchSettings.json is only used by the IDE (for Development), not by the compiled (Self-contained) Web API (Production).

- Workaround to execute the compiled Self-contained Web API on a Specifyc port (using 6500 port):

             (Windows) ServerApis.exe --Urls http://localhost:6500 or ServerApis --Urls http://IP_Address:6500

             (Linux) ./ServerApis --Urls http://localhost:6500 or ./ServerApis --Urls http://IP_Address:6500

Comment
  1. Logan Liu @Appeon
  2. Monday, 20 June 2022 02:11 AM UTC
Hi Alex, thanks for sharing your solution here. I want to add a link to ASP.NET documentation:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#endpoint-configuration

Regards, Logan
  1. Helpful
  1. Alex Riofrio
  2. Monday, 20 June 2022 17:14 PM UTC
Thanks Logan
  1. Helpful
There are no comments made yet.
Alex Riofrio Accepted Answer Pending Moderation
  1. Friday, 17 June 2022 17:23 PM UTC
  2. PowerServer
  3. # 1

Yes, and my launchSettings.json file looks like this:

(with applicationUrl: localhost:6000)

 

Comment
  1. Chris Pollach @Appeon
  2. Friday, 17 June 2022 17:43 PM UTC
You will also need to change the deployed PS App EXE as well to match ...

https://docs.appeon.com/ps2021/Change_Web_API_URL.html
  1. Helpful
  1. Alex Riofrio
  2. Friday, 17 June 2022 17:55 PM UTC
Hi Chris,

Thanks, but the issue is not that, but how to execute the compiled (self-contained) Web API PS 2021 so that it uses:

"applicationUrl" property: "http://localhost:6000/"

or another port.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 17 June 2022 16:53 PM UTC
  2. PowerServer
  3. # 2

Did you read the documentation and follow the instructions for deploying with Kestrel? https://docs.appeon.com/ps2022/Hosting_Web_APIs_in_Kestrel.html

Have you correctly configured the IP and port # in the C# code?  PowerServer C# solution > ServerAPIs project > Properties > launchSettings.json > "applicationUrl" setting.

 

 

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 17 June 2022 16:33 PM UTC
  2. PowerServer
  3. # 3

Are you running the Web APIs on Kestrel or IIS?

Comment
  1. Alex Riofrio
  2. Friday, 17 June 2022 16:35 PM UTC
Hi Armeen;

On Kestrel. Deployment Mode: "Self-Contained"
  1. Helpful
  1. Tracy Huang @Appeon
  2. Wednesday, 22 June 2022 09:43 AM UTC
Hi Alex,



Alternatively, you can use the following command to run the compiled ASP.NET Core app on the specified host name and port number:

dotnet <app_assembly>.dll --urls "http://0.0.0.0:6000"

PowerServer help is incomplete, without mentioning the "--urls" argument. Thank you for helping us find this mistake.



Regards

Tracy
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.