Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: DefaultHttpControllerActivator fast cache is not used if we have multiple controllers [170]

$
0
0
DefaultHttpControllerActivator is optimized for a single ControllerDescriptor. We should have one instance of controller activator per controller descriptor. Our current code create a single instance of DefaultHttpControllerActivator and uses it all across.

Try the sample code,
{
HttpConfiguration config = new HttpConfiguration();
config.Routes.MapHttpRoute("REST", "{controller}");
HttpServer server = new HttpServer(config);
HttpClient client = new HttpClient(server);

client.GetAsync("http://localhost/" + "Controller1").Wait();
client.GetAsync("http://localhost/" + "Controller2").Wait();
client.GetAsync("http://localhost/" + "Controller3").Wait();


Assert.Null(Controller1Controller.Descriptor.Properties.Values.OfType<Func<IHttpController>>().SingleOrDefault());
Assert.NotNull(Controller2Controller.Descriptor.Properties.Values.OfType<Func<IHttpController>>().SingleOrDefault());
Assert.NotNull(Controller3Controller.Descriptor.Properties.Values.OfType<Func<IHttpController>>().SingleOrDefault());
}

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>