Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# url路由捕获全部不工作_C#_Asp.net_Azure_Url Routing - Fatal编程技术网

C# url路由捕获全部不工作

C# url路由捕获全部不工作,c#,asp.net,azure,url-routing,C#,Asp.net,Azure,Url Routing,我自己发送所有请求。我已将模式编写如下: RouteTable.Routes.Add(new Route("{*all}", new URLRouter())); 但是,当对www.example.com/styles/site.css的请求到达时,URLRouter处理程序不会捕捉到它 谢谢。安装了什么IIS版本?看起来静态文件请求甚至无法到达ASP.NET ISAPI筛选器。这是IIS6和IIS7经典模式应用程序池中的默认行为 更新:在Web.config(模块部分)中设置runAllMa

我自己发送所有请求。我已将模式编写如下:

RouteTable.Routes.Add(new Route("{*all}", new URLRouter()));
但是,当对www.example.com/styles/site.css的请求到达时,URLRouter处理程序不会捕捉到它


谢谢。

安装了什么IIS版本?看起来静态文件请求甚至无法到达ASP.NET ISAPI筛选器。这是IIS6和IIS7经典模式应用程序池中的默认行为


更新:在Web.config(模块部分)中设置
runAllManagedModulesForAllRequests=“true”

我已经解决了这个问题。问题似乎是所有请求都传递给了我的URLRouter处理程序,但是对静态内容(例如styles/site.css)的请求并不是由“{*all}”中的url参数变量“all”收集的,并且所有请求都包含null,尽管奇怪的是,这个请求包含在requestContext.HttpContext.request.url中。因此,我使用的是requestContext.HttpContext.Request.Url,而不是Url参数变量“all”

实际上,我认为无论使用什么应用程序池,这都是IIS 6和IIS 7中的默认行为。感谢Chris的回复。这是windows azure WebRole项目。Azure使用IIS7。我怎样才能改变这种行为?因此,所有请求(包括静态内容请求)都由我的模块URLRouter处理。感谢Artem和Abatishchev,runAllManagedModulesForAllRequests已设置:(,而catch all并没有获取所有请求:S,它的设置如下,在web.config中:…我甚至设置了RouteTable.Routes.RouteExistingFiles=true;在ApplicationStart之前设置了RouteTable.Routes.Add(新路由(“{*all}”,new URLRouter()));也许您可以使用
URL Rewrite
模块实现静态文件路由: