URL rewrite for IIS with subdomain rule


I’m already using this rule inside rewrite rules in web.config file which is like this:

My application is dynamically creating subdomains. My application is working like this:

But I want it to work like:

http://subdomain1.domain.com/ --> serves content for subdomain 1
http://subdomain2.domain.com/ --> serves content for subdomain 2 and so on…

So what should I have to write for rewrite rule?

Any help much appreciated. Thank you.