0

I have a ASPNET Core application that works fine on my machine with URL https://localhost:5001/, but not on the client's server, where the application's URL is https://example.com/subfolder/.

The problem seems to be an error in a redirect on one of the pages, where a user is sent to /something rather than /subfolder/something. I'm using relative URL's only. In the rest of the application, redirects work fine.

I was wondering if it is possible to debug the application in Visual Studio and have it run in a subfolder, preferably using Kestrel, but IIS Express might be an option too.

Update after comments While adding specifics about the problem, I found out that I was looking at it from the wrong angle. The actual problem seems to be that the application is started as https://example.com/subfolder (no trailing slash). Redirecting to ./something (or just something) will result in https://example.com/something.

(My real question therefore would be: If https://example.com/subfolder is opened, how can I redirect to https://example.com/subfolder/? I'll first try to fix this myself, maybe it should be configured in the webserver. In the meantime, I'd still like to know if subfolders can be used in debugging)

3
  • It's hard to say what the issue is without seeing the actual error you're experiencing. It's likely a server configuration issue so there is nothing to debug, but that's just a guess Commented Sep 22, 2021 at 13:41
  • My assumption is that Apache/Nginx or whatever reverse proxy you are using is misconfigured. Basically, your reverse proxy should redirect the requests from the root "/" to something like this: "localhost:5001/subfolder/". Commented Sep 22, 2021 at 13:43
  • @Alexander Most redirects work fine, it's just this one that fails, so I don't think it's a server issue. Because I wanted to have a generic answer on how to debug an application in a subfolder, I left out the specifics, but maybe I should add them anyway. Give me a moment. Commented Sep 22, 2021 at 13:55

1 Answer 1

1

In development, it seems you can't debug your program in subfolder.

I don't recommand you to spend a lot of time to serach how to do that, and I also suggest you use IIS. Because in IIS, it supports Virtual Application, and I think it is you want.

Steps:

  1. create a main website, and create a virtual application.

  2. choose the project folder as Physical Path, mainsite and virtualapplication.

  3. open vs2019 as administrator, maybe you need open it twice,and one for main site and another for virtual application.

  4. then you can attach to a running process on your local machine.

  5. you can start your two webapp in one port, and you can debug them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.