Вопрос

I am using the HttpServer class to test my web api. In my application, I have a custom IHttpModule that handles some URL rewriting. I need this module to process the requests for my web api as well. Here is my code that I use to create the HttpServer object.

var config = new HttpSelfHostConfiguration(ServerUrl);
RouteConfig.RegisterRoutes(config.Routes);
FilterConfig.RegisterWebApiFilters(config.Filters);
var httpServer = new HttpServer(config);

Can someone tell me the obvious thing I am missing that I need to do to register my module with the server?

Это было полезно?

Решение

AFAIK you can't use HttpModules with a self hosted WebAPI server. I think what you need is a MessageHandler.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top