How to fake a directory listing in IIS? VirtualPat

2019-09-09 16:56发布

We're using AppFabric 1.1 & IIS 8.0 to run our xamlx based workflows. To make the static xamlx files go away we're used Ron Jacobs perfect sample code to store them in a database and serve the xamlx content trough a VirtualPathProvider.

http://blogs.msdn.com/b/rjacobs/archive/2011/06/15/how-to-load-wf4-workflow-services-from-a-database-with-iis-appfabric.aspx

So far so good, the xamlx files are served if someone hits the right uri.

But now the AppFabric Dashboard has no chance to collect and enlist the xamlx files as services because they're not visible to AppFabric anymore.

The goal must be to fake a directory listing and reading all xamlx workflow names from db.

I've tried to do that by extending the VirtualPathProvider by overriding the Directory based methods this way

    public override bool DirectoryExists(string virtualDir)
    {
        return base.DirectoryExists(virtualDir);
    }

    public override VirtualDirectory GetDirectory(string virtualDir)
    {
        if (IsPathVirtual(virtualDir))
        {
            return new VirtualDirectoryDecorator(base.GetDirectory(virtualDir));
        }
        else
        {
            return Previous.GetDirectory(virtualDir);
        }

    }

But these methods are not invoked the way I have guessed. It's because the Uri has no extension and asp.net does not get called.

Any help appreciated to make this fake directory listing happen!

Thanks

1条回答
Emotional °昔
2楼-- · 2019-09-09 17:23

You need to modify your web.config file to instruct IIS that ASP.NET must be invoked for every request, this is done with the <modules runAllManagedModulesForAllRequests="true" /> attribute in your application root.

I think you should rename your Question, because at first glance I thought you were using VirtualPathProvider internally and wanted to hide IIS's auto-generated directory contents listings pages.

查看更多
登录 后发表回答