Owin hosted in IIS does not capture URLs with a dot ".".

I have an owin project on which I host it using Microsoft.Owin.Host.SystemWeb. It works fine, but if I have a dot in the url, it fails and I get 404. For example

localhost: 4070 / cdn / aa works

but

localhost: 4070 / cdn / aa not working

I also made the following changes to

<system.webServer> <modules runAllManagedModulesForAllRequests="true"> </modules> 

I am sure this option solves the problem in a simple asp.net web api, but I have this problem with Owin.

Update

I tried this with the owin host, it looks like behavior, calls with "." not redirected to webapi.

I can understand that when there is a dot in the last part of the URL, the structure thinks it is a file and tries to process it, but my problem is that I would like to process these URLs in my normal pipeline. I actually write proxies for Microsoft cdn, and files are generated at runtime using a different server.

+6
source share
1 answer

This configuration worked for me:

 <system.webServer> <handlers> <add name="OWIN" path="*" verb="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler" /> </handlers> </system.webServer> 

In contrast to getting the file path from the "public /" folder and putting it in the response, I ended up with this:

 string filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/public" + context.Request.Path); 
+7
source

Source: https://habr.com/ru/post/971100/


All Articles