7

I have an owin project I am hosting it using Microsoft.Owin.Host.SystemWeb. It works fine but if I have a Dot in the url it fails and I get a 404. For example

localhost:4070/cdn/aa works

but

localhost:4070/cdn/a.a doesn't work

I have also done the following changes in

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

I am sure this setting solves the problem in plain asp.net web api but I am having this issue with Owin.

update

I have tried this with owin host it is similar behavior, the calls with "." are not routed to webapi.

I can understand the behavior that when there is a dot in the last part of the url the framework thinks it is a file and tries to handle it but my problem is that I would like to handle these urls in my normal pipeline. I am actually writing a proxy for Microsoft cdn and the files are generated on run time using another server.

Ovais
  • 276
  • 1
  • 16

1 Answers1

8

This config worked for me:

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

In odred to get file path from "public/" folder and put it in response I ended up with this:

string filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/public" + context.Request.Path);
Alexander Shutau
  • 2,660
  • 22
  • 32