mercredi 19 décembre 2018

AspNet MVC restrict routing to resolve controllers from a certain assembly

I have an Asp.Net Web Forms project, later on I've added the WebApi support to it, so now I can access both the .aspx pages + controller action api.

Now, The startup process takes up to 50 seconds, after profiling, I've noticed that one of the issues is System.Web.Http.Routing.AttributeRoutingMapper() takes about 10 seconds (most probably because it uses reflection to resolve controllers). enter image description here

The project loads many assemblies (hundreds), and we have some very big auto-generated classes which may slow down the reflection process.

What I am thinking is to to move all controllers to a separate assembly and force the router to look only their.

Is this possible, if yes can you give me some hints how ?

Notes: removing assemblies, reducing classes sizes is out of scope for me.





1 commentaire:

  1. Hi, I have exactly the same situation as yourself, did you ever find a way to restrict the scan of attributes?

    RépondreSupprimer