1. Sim Joo Pee
  2. PowerServer
  3. Wednesday, 6 March 2024 13:04 PM UTC

Hi,

  I am digesting how to make web api run on linux. Referring to this link https://docs.appeon.com/ps2022r2/Running_Web_APIs_with_Kestrel.html

I understand that,

1) Copy all files from net6.0 folder to linux server

2) Run this  ServerAPIs.exe --urls "http://<hostname>:<port>"

My question is, http://<hostname>:<port> is the one i put at NET SERVER project  when compile?

If yes, may i know how to setup this http://<hostname>:<port>? 

Thanks. Hope someone can guide me.

Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 March 2024 14:22 PM UTC
  2. PowerServer
  3. # 1

Hi Sim,

The URL you specify in the --urls parameter is the address the Web APIs are to listen on (on the server machine), which most likely won't be the same URL in your PowerServer project (which communicates with the server from outside the network).

For the simplest deployment, you should just pass to --urls 0.0.0.0:<port> (this makes the Web APIs listen on all interfaces), configure your server to reverse proxy incoming requests to <port>, and then in the PowerServer project you use the URL of the server. What port to use in here depends on your server configuration. As long as the server reverse proxies to the <port> you configured on --urls you should be good.

Regards,
Francisco

Comment
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Thursday, 7 March 2024 00:51 AM UTC
  2. PowerServer
  3. # 2

Hi

Are the above for development? I am working on production. Hence, i need to figure out my linux available port right?

and when compile my powerserver project, NetServer section, i just put the hostname/ip address with available port number right?

In linux based , how to run the below? Use putty? or?

Method 2: Run the app by executing the following command:

ServerAPIs.exe --urls "http://<hostname>:<port>"
Comment
  1. Francisco Martinez @Appeon
  2. Thursday, 7 March 2024 15:20 PM UTC
"and when compile my powerserver project, NetServer section, i just put the hostname/ip address with available port number right?



In linux based , how to run the below? Use putty? or?"



Sorry Sim, all these things depend on your particular network infrastructure/server architecture so I'm can't provide any concrete advice.

Please review this documentation page where it's explained how to host Web APIs under Linux (https://docs.appeon.com/ps2022r3/Using_a_reverse_proxy_server.html)
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Friday, 8 March 2024 09:31 AM UTC
  2. PowerServer
  3. # 3

Thanks.

 

CUrrently I had successfully using IIS as web server with API hosted on the same IIS server. So, now i wanted to move the API from IIS server to be hosted in the DB server and use Nginx as web server.  DB server OS is linux.  Hence, pleaase correct is below steps is wrong also i have two questions below.

 

1. Install Nginx    https://docs.appeon.com/ps2022/Installing_Nginx_Linux.html

2. Packaging the client app ->>>>> Question: Net server - WEB API URL - Host - is it the Linux server ip address?

3. Publish the PowerServer Web APIs from the SnapDevelop IDE to a folder

4. Copy the clouapp files from item2 above to Linux server    /usr/share/nginx/html

5. Copy all files from the publish folder to the linux server.  ->>> Question: May i know if anybody can tell me, which folder normally? i dnt know because the appeon document never teach this.

6. Any services need to bring up? like in IIS,, need to start client and API.

 

Please advice. Thanks a lot.

 

 

Comment
  1. Francisco Martinez @Appeon
  2. Friday, 8 March 2024 14:42 PM UTC
->>>>> Question: Net server - WEB API URL - Host - is it the Linux server ip address?

Yes. The port on which nginx is listening (on the default config file it listens on port 80)



->>> Question: May i know if anybody can tell me, which folder normally? i dnt know because the appeon document never teach this.

It doesn't matter where you put the folder with the Web APIs because you're going to run them manually, have them listen on a specific address and then configure nginx to redirect incoming requests to this address



Any services need to bring up? like in IIS,, need to start client and API.

You will need to start the nginx server and start the Web APIs with dotnet
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Monday, 11 March 2024 03:53 AM UTC
  2. PowerServer
  3. # 4

 

Thanks.

->>> Question: May i know if anybody can tell me, which folder normally? i dnt know because the appeon document never teach this.

It doesn't matter where you put the folder with the Web APIs because you're going to run them manually, have them listen on a specific address and then configure nginx to redirect incoming requests to this address

<SJ 20240311>  How to redirect?

Any services need to bring up? like in IIS,, need to start client and API.

You will need to start the nginx server and start the Web APIs with dotnet
 
<SJ 20240311> how to start the Web API with dotnet? it is on Linux / Nginx platform now.
Comment
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Tuesday, 12 March 2024 08:15 AM UTC
  2. PowerServer
  3. # 5

Hi,

 I finally can run the API on linux, but why showing error "session creation failed" Failed to send the request(WEB API) etc... (see attachment).  It is not on proxy server. Web server is nginx.  I had tried all but so far, i had running out of idea, where had went wrong.

Can kindly enlightened me? Thanks.

Attachments (1)
Comment
  1. Francisco Martinez @Appeon
  2. Tuesday, 12 March 2024 14:28 PM UTC
Most likely you need to open port 5000 on the server to allow incoming connections through that port
  1. Helpful
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Monday, 18 March 2024 07:16 AM UTC
  2. PowerServer
  3. # 6

Hi,

  I am finally able to run the API on linux box and my application can connect to db, using Method 2, which is run the API by executing command (ServerAPIs.exe --urls "http://<hostname>:<port>").

 

But it doesnt work if i run using run the API as a service in Linux. See attachment for error messge. Anybody can help me?

Thanks.

Attachments (1)
Comment
There are no comments made yet.
Sim Joo Pee Accepted Answer Pending Moderation
  1. Monday, 18 March 2024 09:38 AM UTC
  2. PowerServer
  3. # 7

HI,

  After i added user id and password into application.json, the error become different 'at System.IO.File.WriteAllTextAsync(String path, String contents, CancellationToken cancellationToken)'  (see attachment for more).  Do you have any idea? please help. Thank you.

Attachments (1)
Comment
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.