从网站获取IIS站点ID [英] Get IIS site id from a website

查看:504
本文介绍了从网站获取IIS站点ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net c#中创建了一个用户控件。因为我需要检索一些数据,我想获得在iis中用于此站点的站点ID。这是可能的,如果是的话,怎么样?

I have made a user control in asp.net c#. Becuase of some data I need to retrieve I would like to get the site id that is used for this site in iis. Is this possible, and if so, how?

谢谢!

推荐答案

这将为您提供站点ID:

This will give you the site ID:

Request.ServerVariables[ "INSTANCE_ID" ]

如果您只需要获取一次,那么您可以在IIS MMC中查找日志文件路径。 W3SVC部分后面的数字也是网站ID。

If you just need to get it once then you can lookup the log file path in the IIS MMC. The number after the "W3SVC" part is also the site id.

这篇关于从网站获取IIS站点ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆