Service Fabric On Prem with Razor Application

Paul Widenka 1 Reputation point
2020-06-10T04:03:32.843+00:00

Hi.

I'm trying to get a Razor .NET core 3.1 Application running on our on Prem Service Fabric Cluster.

Currently I'm trying to use the Reverse Proxy which almost works and we think we can make work using out BIG IP but i'm not sure if this is the best way.
This will mean we can use they same certs and all the benefits from the Proxy.

There are issues with referencing the .css styles and links from the Initial Layout.

e.g. If we use the Reverse Proxy we use/reference
https://clustername.domain:19081/MyServiceName/MyApplication/

If using a nominated port then this would be
https://clustername.domain:8764/ and all paths resolve.

Using the Proxy we loose references to the Application (wwwroot) Resources
It looks like I can add full urls to resolve the .css references.
e.g. href="/MyServiceName/MyApplication/css/site.css"

If after say the default Index page loads, I click for example asp-page="/Help" , when using the proxy, it drops off the /MyServiceName/MyApplication/. I can add this in the browser and it resolves.

If I try and hardcode asp-page="/MyServiceName/MyApplication/Help" this does not work.

Is there a way to set the Application Route in the Service Fabric Razor App so that it starts with /MyServiceName/MyApplication/

We think that we might be able to add this on the Big Ip but it would be nicer if this was contained in the application so that we can run the same code on our development machines and service fabric cluster environments.

Does anyone have any details on how I can set this up?
Is this a viable option or should I be using a fixed/nominated port?

I can not find much advise or example of doing this with and On Prem cluster. Does anyone know any good resources? I have spent a lot of time trawling and trying to resolve this.

We have only previously used API Services through the Reverse Proxy which works as we want. This is the first time trying to put a Web App through.

Please can someone give me some advise on getting this working.
Many thanks,
Paul

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
254 questions
{count} votes

1 answer

Sort by: Most helpful
  1. prmanhas-MSFT 17,891 Reputation points Microsoft Employee
    2020-07-28T16:55:06.593+00:00

    @Paul Widenka Apologies for the delay in response and all the inconvenience caused because of the issue.

    By reading the above problem statement, my recommendation would be to use fixed/nominated port for it so that you do not have to worry about context path to each URL. Moreover running locally or on fabric, it should run at same URL's so that any issue can be identified during development only. This is just personal recommendation basis the situation which you are running into.

    However adding manually "/MyServiceName/MyApplication/Help" in the asp page should work generally, what is the url it is trying to load when you click on this link after deployment? This might not be working locally as it could not be resolved locally but should work once you have proxy configured for it.

    Another approach which you can use it to rewrite the request url at the proxy level to append specific path before routing it to appropriate service or so.
    But I won't suggest using this approach as it would be difficult to identify the request originating application and better approach would be to use different port for each application so any context switch (url rewriting or other filteration) can be done at proxy level.

    Hope this helps.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics

    0 comments No comments