[英]The pattern of application ID in a .Net
When i get the application id of a request by using below code: 当我通过使用以下代码获得请求的应用程序ID时:
string appID = System.Web.Hosting.HostingEnvironment.ApplicationID;
I am getting the appID as 我得到的appID为
/LM/W3SVC/1/ROOT/MvcMusicStore / LM / W3SVC / 1 / ROOT / MvcMusicStore
My main motive is to get the website ID from this.. It resides after W3SVC. 我的主要动机是从中获取网站ID。它位于W3SVC之后。 (1 is the website id in this case). (在这种情况下,1是网站ID)。
i need to confirm with the geeks over here will the application ID's output will be in this pattern only.? 我需要在这里与极客确认,应用程序ID的输出将仅是这种模式。
So that it will not be a issue for me if a implement a generic string parsing and take the number that comes after 9th position in the string. 因此,如果实现通用字符串解析并采用字符串中第9位之后的数字,对我来说就不是问题。 Or will the pattern vary wrt the IIS version or some other factor. 否则该模式会因IIS版本或其他因素而有所不同。 ? ?
When running the application under IIS is always of that format, it doesn't change. 在IIS下始终以这种格式运行应用程序时,它不会更改。 If you don't need to run it under any other platform, you can take that value. 如果您不需要在任何其他平台上运行它,则可以利用该价值。
The ID is based on the metabase path, which was used in IIS earlier, but even though the metabase is no longer used in the current IIS versions, the AppliationID is still the same (even tested with Windows Server 2012 R2's IIS). 该ID基于以前在IIS中使用的配置数据库路径,但是即使在当前的IIS版本中不再使用该配置数据库,AppliationID仍然相同(即使已在Windows Server 2012 R2的IIS中进行了测试)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.