1

I'm trying to run my ASP.NET MVC 5.2.3.0 application as nested application so that I can access it as a subfolder, like http://example.com/my-application. I've added it to an existing application by choosing Add Application a chosen separate application pool. When I run my-application on its own URL it works fine however when I try to run it as http://example.com/my-application it refuses to render bundles, neither style nor js. What I have tried so far:

  • I have tried to enable and disable bundling and minification. When it's disabled Styles.Render adds nothing to markup. When it's enabled invalid link to bundle is added to markup, for example <link href="/calc/bundles/styles/mainlayout?v=" rel="stylesheet"/> and the link returns empty document.
  • I have tried to put my-application to empty website to ensure no side effects inherited. No difference here.
  • I have tried to put brand new application side by side with my-application and bundling worked fine there so it must be something wrong with my application and I can not find what exactly.
  • I have tried to ILSpy System.Web.Optimization code but couldn't find any help there.
  • I have failed to debug System.Web.Optimization as my VS just hung.
  • I didn't find any conflicting routes with my-application address.

If anyone faced the same issue then any advice appreciated. Thanks.

UPDATE: I found what causes the issue. We intensively use T4MVC and we use it for bundles configuration as well. So our bundle declaration looks something like:

bundles.Add(new ScriptBundle("~/bundles/scripts")
       .Include("~" + Links.Scripts.Script1_js, "~" + Links.Scripts.Script2_js));

And "~" + Links.Scripts.Script1_js for nested application gives me ~/my-application/scripts/script1.js while VirtualPathProvider from inside Include method expects it to be ~/scripts/script1.js.

So the question transforms into: does anyone know how to prevent T4MVC from adding nested application path onto static files links so that application isn't aware of being nested? I bet @David Ebbo knows how to achieve this :)

Denys Denysenko
  • 7,598
  • 1
  • 20
  • 30

0 Answers0