简体   繁体   English

.Net中的应用程序ID模式

[英]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.

相关问题 .net 核心应用程序需要使用 _id 和 id 与 mongodb 现有集合通信 - .net core application needs to talk to mongodb existing collection with _id and id ASP.NET MVC 5应用程序-没有实体框架的存储库模式 - ASP.NET MVC 5 application - Repository pattern without Entity Framework asp.net mvc应用程序中的工作单元模式 - The unit of work pattern within a asp.net mvc application 如何在 .NET 5 控制台应用程序中使用 Autofac 和选项模式? - How can Autofac and an Options pattern be used in a .NET 5 console application? 用MVC设计模式编写点网桌面应用程序 - Writing dot net desktop application with MVC design pattern 来自 ASP.NET Core 身份的 Application Insights 用户 ID - Application Insights User ID from ASP.NET Core identity 为ASP.Net应用程序中的页面创建唯一的ID - Create a unique ID for a page in an ASP.Net Application 如何在.net窗口应用程序中设置处理器ID的信任级别? - How to set the trust level for processor ID in .net window application? 如何从一个表中获取 Id 并将其保存到 ASP.NET Core 中的另一个表,存储库模式 - How to get an Id from one table and save it to another table in ASP.NET Core, repository pattern 如何将我的十进制线程ID转换为十六进制,并使其在log4net转换模式中以十六进制格式显示? - how to convert my decimal thread ID to hex and make it appear in hex format in log4net conversion pattern?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM