locked
Microsoft.Web.Administration Get a unique persitent key per site? RRS feed

  • Question

  • User402016585 posted

    I am developing a small util that iterates the sites in IIS using Microsoft.Web.Administration.ServerManager and store basic info about the site, bindings, virtual apps and so on in database tables and this works fine. I also have tables for Customer info, "platform versions/info/service" and so on, these tables use the Web.Administration Site.Id as relation/join key.

    The problem is that if sites are deleted in IIS the Site.Id will be "reused" for next added site in IIS, if I have site id 1,2,3 and delete site 2 and then add a new site the new site will get Site.Id=2 which I find strange.  This mess my relation between Site and Customer so I can not use Site.Id, same goes for Site.Name (if name modified in IIS).

    Is there a way of getting like a persistent unique guid-like key per site, that is not re-used?

    Cheers!

    Wednesday, November 9, 2016 5:13 AM

Answers

  • User-460007017 posted

    Hi AndersSmedman,

    According to this reference:https://msdn.microsoft.com/en-us/library/microsoft.web.administration.site.id(v=vs.90).aspx, it is able to grant unique identity for site with hash-based identity.

    Please take the following steps:

    1.open Run->regedit

    2.navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetMgr\Parameters\IncrementalSiteIDCreation

    3. set the DWORD to other than 1.

    4.Close the registry editor

    Once the registry dword is set, then the website will be granted unique hash-based identity. If the dword is set to 1, then IIS will use legacy identity mode and grant new site with missing ID.

    Best Regards,

    Yuk Ding

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, November 10, 2016 2:59 AM

All replies

  • User-460007017 posted

    Hi AndersSmedman,

    According to this reference:https://msdn.microsoft.com/en-us/library/microsoft.web.administration.site.id(v=vs.90).aspx, it is able to grant unique identity for site with hash-based identity.

    Please take the following steps:

    1.open Run->regedit

    2.navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetMgr\Parameters\IncrementalSiteIDCreation

    3. set the DWORD to other than 1.

    4.Close the registry editor

    Once the registry dword is set, then the website will be granted unique hash-based identity. If the dword is set to 1, then IIS will use legacy identity mode and grant new site with missing ID.

    Best Regards,

    Yuk Ding

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, November 10, 2016 2:59 AM
  • User402016585 posted

    Hi!

    Thanks, so thats the only way, strange. Then I know and thank you for your feedback.

    /Anders

    Thursday, November 10, 2016 5:38 AM