How to dynamically create Web APIs (REST apis) in selfhosted owin server? -


i'm looking way dynamically generate web apis , add them @ runtime (after selfhosted server has been initialized).

basically idea to: 1. create selfhost owin server serving static/already defined controllers (web apis) -> part ok

  1. at later time, want dynamically generate new controller , add somehow server client can send request it. -> there way that? know can dynamically build controller , add server before initialized serves existing web apis (using customassemblyresolver).

  2. now existing controller may need updated. re-generate existing controller , update server use new definition (maybe parameter change, name of apis changed, etc.) way that? can recycle controller without stopping controllers? if somehow can supported, mean service not available time (until update done).

  3. ideally work web service hosted in iis. if web service definition change between 2 requests. 1st request go old definition , 2nd request transparently directed new definition. there no interruption of service.

any ideas?

thanks in advance

found solution it. in case else looking this, need overwrite defaulthttpcontrollerselector. here nice article on subject: link use case mentioned above, need create new appdomain, start service in it, , load assemblies dynamically @ runtime. need overwrite defaulthttpcontrollerselector catch request. when request arrive, have control on controller want use. there can update controller dynamically loading new assembly, etc. main thing careful on executed each request impact performance , memory. implement own caching of controller.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -