I have an incomprehensible bug recently.
I published a ASP.NET Core MVC web application to a folder, when I enter the root path of the website and run it using command
d:\publish> dotnet WebSite.dll
all things works fine.
but when I go to the parent folder of this website, and then use below command to run it.
d:\> dotnet ./publish/WebSite.dll
the web site can visit,but all the static files given a 404 error
,
I want to know, why? how can I solve this?
~/path prefix to specify that it should be relative to the document root. If you use just/at the beginning of your paths, then that will be domain relative, which may or may not be the same thing. Bear in mind that~/is non-standard, though, so it only works in things like Razor views, as Razor will extrapolate that for you. If you're referencing paths in something like a JS file, you'll need a different solution.