1. Pascal Phan
  2. PowerServer
  3. Friday, 3 November 2023 18:42 PM UTC

Hi Appeon,

I got the following http status code 404 error on https (not http) when I am running my app.

 

I went to https://docs.appeon.com/ps/troubleshooting_guide/Session_creation_failed.html and could not find anything related to that error.

I can start my web api no problem:

 

Here is my web config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="/API" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<add name="aspNetCore2" path="/health-*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<add name="aspNetCore3" path="/connect/token" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\API\ServerAPIs.exe" stdoutLogEnabled="false" stdoutLogFile=".\API\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 9545C5FF-D7E5-4099-B960-10FDF0999640-->

 

Pascal 

 

 

 

 

Accepted Answer
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Thursday, 9 November 2023 06:42 AM UTC
  2. PowerServer
  3. # Permalink

Hi Pascal,

Is it possible that this issue was caused by the path of the URL?

Refer to: web.config - - PowerServer 2022 R2 Help (appeon.com)

Note

If you create and map a new site (or sub-app) to the site where web.config and Web APIs are deployed, and specify the URL of the new site (or sub-app) as the Web API URL, then you must also make sure the handler path includes the new site (or sub-app), for example, you may have to change the path from "/api", "/health-*", "/connect/token" etc. to "new_site_url/api", "new_site_url/health-*", "new_site_url/connect/token", etc.

For example,

path="/powerserver/ReportApiExample/api"

path="/powerserver/ReportApiExample/health-*"

path="/powerserver/ReportApiExample/connect/token"

The leading forward slash (/) indicates the root of the website, and the directory or virtual directory name is specified thereafter.

 

Alternatively, if you are already using the IIS sub-app to deploy the PowerServer Web API, you don't need to use the web.config. 

You can access the health-ui page to verify the PowerServer Web API. Refer to: Verifying the Web APIs - - PowerServer 2022 R2 Help (appeon.com)

Regards, Logan

Comment
There are no comments made yet.
Pascal Phan Accepted Answer Pending Moderation
  1. Friday, 10 November 2023 15:16 PM UTC
  2. PowerServer
  3. # 1

Hi Everyone,

 

   Thankyou for all your reply. I got this issue working by doing the following:

 

1. Add code to start the Create Session to the Open event of the Application:

long v_return

Try v_return = Getapplication().Beginsession()


    if v_return <> 0 then
        Messagebox("Begin Session failed:" + string(v_return), GetHttpResponseStatusText())
    end if

Catch (Throwable ex)
    MessageBox("Throwable", ex.GetMessage())

End Try

 

2. Make sure this option below is checked.

 

3. Make sure the proper path with "/" is included in the apprun.json file

{
"deployment_urls": {
"launcher": "CloudAppPublisher/CloudAppInstall 22.0",
"runtime": "CloudAppPublisher/runtime/22.1.0.2819",
"web_api": "https://intdev19.dev.service.gc.ca:443/rbrs_dev/rbrs/rbrs_cloud_api/"
   }
}

 

  This method will create session in the App instead of replying on the web api. 

 

  

 

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 13 November 2023 19:33 PM UTC
Thanks for sharing the solution!
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Saturday, 4 November 2023 23:06 PM UTC
  2. PowerServer
  3. # 2

Did you configure the Web API URL for your client app to use HTTPS instead of HTTP?

Comment
  1. Pascal Phan
  2. Monday, 6 November 2023 21:15 PM UTC
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Monday, 6 November 2023 21:31 PM UTC
Then your URL is incorrect or you didn’t deploy the Web API to the server.
  1. Helpful
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Friday, 3 November 2023 19:31 PM UTC
  2. PowerServer
  3. # 3

Hi Pascal,

What do you see if you access the url https://<your hostname>/rbrs_dev/rbrs/api/Application/LoadAll in the browser?

 

Regards,
Francisco

Comment
  1. Pascal Phan
  2. Friday, 3 November 2023 20:20 PM UTC
I am using Pb2022 R2 Build 2819 and that url https://<your hostname>/rbrs_dev/rbrs/api/Application/LoadAl not exist
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 3 November 2023 20:50 PM UTC
Hi Pascal ... Do you need a port number for PS?

ie: https://<your hostname>:NNNN/rbrs_dev/rbrs/api/Application/LoadAll

Regards .. Chris
  1. Helpful
  1. Francisco Martinez @Appeon
  2. Friday, 3 November 2023 21:06 PM UTC
@Pascal,did you replace <your hostname> with the hostname where the app is hosted? You should have tried https://intdev19.dev.service.gc.ca/rbrs_dev/rbrs/api/Application/LoadAll



If the Web APIs are working correctly you should see a JSON response. If not then you should verify that you deployed the Web APIs correctly

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 3 November 2023 18:54 PM UTC
  2. PowerServer
  3. # 4

Hi Pascal;

  This might have been a Timeout issue. Have you checked the PowerServer log for any error(s) leading up to this 404 error?

Regards ... Chris

Comment
  1. Pascal Phan
  2. Friday, 3 November 2023 20:22 PM UTC
Not much useful info in the PowerServer Log and below is the log content:

2023-11-03 14:02:26,014 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Hosting environment: Production

2023-11-03 14:02:26,016 INFO Microsoft.Hosting.Lifetime.OnApplicationStarted [0] - MESSAGE: Content root path: E:\Appstage\INT_LB_Intra\RBRS_DEV\rbrs\API

2023-11-03 14:23:23,320 INFO Microsoft.Hosting.Lifetime.OnApplicationStopping [0] - MESSAGE: Application is shutting down...

  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.