2

I added the following lines to Application_Start method in global.asax:

var provider = new TestVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider);

Yet the 'TestVirtualPathProvider' is never used when deploying this application in IIS6 (it does in the ASP.NET Development Server).

Edit: the default path provider has always done its job correctly and served (non-embedded) views correctly. The problem is simply that I want to use my own path provider to provide embedded views. So, initially, I already had the following wildcard mapping configured:

Used wildcard mapping screenshot

Any possible reasons why this does not work in IIS6? Are there any other factors (handlers for example) wich might influence the used VirtualPathProvider?

Bertvan
  • 4,943
  • 5
  • 40
  • 61
  • What are you using this Virtual Provider for? – Claudio Redi Aug 30 '10 at 14:31
  • The TestVirtualPathProvider actually does nothing, it's just for testing. I would like to load embedded views from another assembly. I've seen enough examples, but can't seem to get any working under IIS6... – Bertvan Aug 30 '10 at 14:43
  • It's very weird. I'm currently using it without problems on IIS6. The only difference is: I'm not registering the provider on global asax. For testing purposes you could try to do it somewhere else and see what happens. Probably this won't help at all but we may try with that for a starting... – Claudio Redi Aug 30 '10 at 15:08
  • Just as reference I give you this url http://support.microsoft.com/kb/910441 You might want to verify your scenario against that. – Claudio Redi Aug 30 '10 at 15:13

4 Answers4

1

UPDATE: the fact that you want to handle extension-less URL's is an important point that's not mentioned in the question. Please see this page for help in setting up MVC with IIS 6: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx. This should cover your scenario as well.


Most likely the same issue that I answered in this thread: http://forums.asp.net/t/995633.aspx

Basically, add this in your web.config:

<httpHandlers>
  <add path="*" verb="GET,HEAD,POST" type="System.Web.StaticFileHandler" validate="true" />
</httpHandlers>

That other thread has some details that explain why this is necessary.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • I found that link as well. The problem is, they are looking for 'static resources', while I'm looking for extensionless url's (ASP.NET MVC). I'm suspecting that that's where the problem is... – Bertvan Sep 02 '10 at 06:36
1

For the combination Custom VPP + IIS6 + Precompiled site, we need to add the VPP from AppInitailize();

public static class AppStart
{
    public static void AppInitialize()
    {
    // code to be executed automatically by the framework
    }
}

See also:

http://sunali.com/2008/01/09/virtualpathprovider-in-precompiled-web-sites/

Bertvan
  • 4,943
  • 5
  • 40
  • 61
0

I believe that you need to use an ISAPI filter in IIS6 to intercept URLs without extensions. Problem is that ISAPI will need to be done in c/c++.

Mike
  • 3,462
  • 22
  • 25
  • Yes, and the ISAPI can be ASP.NET. Use a wildcard mapping. – John Saunders Sep 03 '10 at 02:47
  • I am using a wildcard mapping (see added screenshot). Or are you talking about a mapping within the web.config as well? – Bertvan Sep 03 '10 at 06:48
  • Difference between Isapi extension and Isapi filter. You need to write a filter that changes the upstream URL/extension to be one that is handled by asp.net. This way the user sees no extension and asp.net sees aspx. This will only take a few lines of code in an isapi filter to accomplish. – Mike Sep 07 '10 at 19:15
0

IIS6 is configured to allow only certain extensions to be processed by the ASP.net pipeline. To findout how you can redirct requests check out the post by DocV.

Community
  • 1
  • 1
Vinay B R
  • 8,089
  • 2
  • 30
  • 45