Reputation: 31
In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple times , even when i have not restarted the application.
Its being repetadly called when i am calling different actions , so the webconfig is repetedly updating & making my application very very slow.
Can you please let me know , what's the reason & how to handle this .
Thanks in advance Aayushi
Upvotes: 2
Views: 3601
Reputation: 7579
You application will be restarted once web.config is modified.
It doesn't make any sense changing web configuration file in application_start. Moving changeable part into a separate file
Upvotes: 1
Reputation: 18419
Everytime you change something in your web.config. That will refresh your application, therefore application_start is also called everytime you open your site. When web.config is changed, your application restarts.
Upvotes: 4
Reputation: 1082
I dont know which elements in your web.config you are updating. If these are custom elements maybe you can put these things in a separate config file (xml file) and update that file.
Upvotes: 1