How to fake a directory listing in IIS? VirtualPathProvider works for file but

杀马特。学长 韩版系。学妹 提交于 2020-01-06 07:32:08

问题


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:


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.



来源:https://stackoverflow.com/questions/15061602/how-to-fake-a-directory-listing-in-iis-virtualpathprovider-works-for-file-but

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!