CPSCS-INNAV-REST-API: Proof of Concept


Rest API URI

http://ncrws496:41000/saf-sec-sur/4/cpscs-innav-rest-api-core/swagger

http://ncrws496:41000/saf-sec-sur/4/cpscs-innav-rest-api-core/api/ship

Note: If .Net Core app is published to a virtual application on IIS, you have to add configuration to the UseSwaggerUi3() call in Startup.cs, to override the default path used by swagger with the correct one.

For this project, this was used: 

app.UseSwaggerUi3(config => config.TransformToExternalPath = (internalUiRoute, request) =>
{
    if (internalUiRoute.StartsWith("/") == true && internalUiRoute.StartsWith(request.PathBase) == false)
    {
        return request.PathBase + internalUiRoute;
    }
    else
    {
        return internalUiRoute;
    }
});


Also, if publishing to a dev server, edit the published web.config file to ensure that the application is run in 'Development' mode on the server, rather than the default 'Production'.

Replace the line: <aspNetCore processPath="dotnet" arguments=".\CPSCS_INNAV_WS.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />

with

<aspNetCore processPath="dotnet" arguments=".\CPSCS_INNAV_WS.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" >
    <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
    </environmentVariables>
</aspNetCore>


Then:

change stdoutLogEnabled="false" to stdoutLogEnabled="true" to generate logs and verify that it is running in dev mode.


ASMX starter page (Redirects calls to REST API Above)

http://ncrws496:41000/saf-sec-sur/4/cpscs-innav-ws-asmx-redirect/service.asmx