I was unable to configure a root as per rsennas answer with an ASP.NET MVC project.
Neither Rider nor Visual Studio control the configuration of the web server (IIS Express), instead they both just generate an applicationhost.config
file that they pass to IIS Express. You should see something like this when you start the application from Rider
C:/Program Files/IIS Express/iisexpress.exe "/config:C:/foo/.idea/config/applicationhost.config" "/site:foo" /apppool:Clr4IntegratedAppPool
Starting IIS Express ...
to spot which applicationhost.config
file is used. Specifically, the relevant section looks (ish) like this
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<!-- ... -->
</site>
Unfortunately, neither Rider nor Visual Studio is particularly good at generating this file. Rider tends to yield incorrect configurations and Visual Studio tends to be inconsistently formatted ¯\_(ツ)_/¯
You can use a diff-tool (like vimdiff) to compare the two (preferably after harmonizing the formatting) and pull the relevant configurations from one file to the other.
Specifically, it appears IIS Express requires a root website. In my case I had to change something like this
<site name="foo" id="1" serverAutoStart="true">
<application path="/foo">
<virtualDirectory path="/" physicalPath="C:/Foo" />
</application>
</site>
into
<site name="foo" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<application path="/foo">
<virtualDirectory path="/" physicalPath="C:/Foo" />
</application>
</site>