3

I'm having problems when deploying my application to a server using a virtual directory in IIS.

I have configured the same files to run under the default website in a virtual directly and also in a new website root running on port 81. Both configurations use their own identical app pools. While the site on port 81 works fine the site running in a virtual directory doesn't load the bundles.

In the page I see links with missing versions in the URL, such as:

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

The URL returns a 200 status from the server, but the content is completely empty.

I have looked on SO at questions like this which references this bug ticket but my understanding is that this is when the files being included in the bundle are 'virtual' or not under the physical folder root. Which is not true in my case.

Cheers for any help you can give me. I can't believe that this configuration wouldn't be supported so I must be doing something wrong somewhere!

Update: I think a ticket describing my problem has been raised on the web optimisations codeplex site here http://aspnetoptimization.codeplex.com/workitem/55 Not that this gets me any further though :(

Community
  • 1
  • 1
Rob Bird
  • 3,764
  • 2
  • 28
  • 38
  • Are you using 1.1-alpha1 or the 1.0 version of Optimization? – Hao Kung Jan 23 '13 at 19:40
  • Hi Hao - Thanks for the reply. I was really hoping that was going to be it, but sadly no, I am in fact using 1.0. I have added the nuget library 'Microsoft.AspNet.Web.Optimization'. I've also found that when I run in visual studio using full IIS (with virtual dir) it has the same behaviour. – Rob Bird Jan 23 '13 at 21:08

1 Answers1

2

After comparing with a new project I tracked down the problem:

I was using T4MVC (trying to be clever and not use 'magic strings' in my code). So I was using a link such as

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

When this runs under a virtual directory it will resolve with the virtual directory name in the path, so it can't find the files.

I hope this helps someone else who runs into the same problem. Also, it looks like T4MVC are looking to improve the use of magic strings in bundles in future releases. See here for a discussion

Rob Bird
  • 3,764
  • 2
  • 28
  • 38