System.Web.Optimization packages empty when run in virtual directory

I am having problems deploying my application to a server using a virtual directory in IIS.

I have configured the same files that run on the default web site in virtual mode, as well as the new root web site running on port 81. Both configurations use their own identical application pools. Although the site on port 81 works fine, the site running on the virtual directory does not download packages.

On the page, I see links with missing versions in the url, for example:

<link href="/MyVirtualDir/Content/css/site?v=" rel="stylesheet">

The url is returning status 200 from the server, but the content is completely empty.

I looked at SO for questions like this which referencing this ticket with an error but I understand that this is when the files included in the kit are "virtual" or not under the root of the physical folder. This is not true in my case.

Greetings for any help you can give me. I can't believe this configuration will not be supported, so I must be doing something wrong!

Update: I think the ticket describing my problem was raised on the codeplex optimizations website here http://aspnetoptimization.codeplex.com/workitem/55 Not that this is me anymore :(

+3


source to share


1 answer


After comparing with a new project, I found the problem:

I used T4MVC (trying to be smart and not use "magic strings" in my code). So I used a link like

bundles.Add(new ScriptBundle("~/Scripts/all")
            .Include("~"+Links.Scripts.Library.jqueryPlugin.jquery_ui_js), ...));

      



When this is done under a virtual directory, it will resolve with the virtual directory name in the path, so it cannot find the files.

Hope this helps someone else facing the same problem. It also looks like T4MVC is looking to improve the use of magic strings in packages in future releases. See here for discussion

+2


source







All Articles