我如何知道在哪个IIS版本我的Asp。网络应用程序运行?

时间:2021-04-02 20:13:58


How can I know under which IIS version my web application is running in development server?
As .Net framework 2.0,3.0,3.5,4.0 have support built in IIS....
Thanks

我如何知道我的web应用程序在哪个IIS版本下运行?随着。net framework 2.0,3.0,3.5,4.0支持建在IIS ....谢谢

5 个解决方案

#1


13  

To get the IIS version of the webserver you can use the SERVER_SOFTWARE server variable.

要获得webserver的IIS版本,可以使用SERVER_SOFTWARE server变量。

Request.ServerVariables["SERVER_SOFTWARE"];

It will return something like as follows:

它将返回如下内容:

Microsoft-IIS/5.0 (Windows 2000)

microsoft iis / 5.0(Windows 2000)

Microsoft-IIS/5.1 (Windows XP)

microsoft iis / 5.1(Windows XP)

Microsoft-IIS/6.0 (Windows 2003 Server)

microsoft iis / 6.0(Windows 2003服务器)

You can find a full reference of server variables here.

您可以在这里找到服务器变量的完整引用。

#2


9  

This is available directly from the SERVER_SOFTWARE server variable:

这可以直接从SERVER_SOFTWARE server变量获得:

HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"];

which is a string like "Microsoft-IIS/7.0".

它是一个类似于“Microsoft-IIS/7.0”的字符串。

NB, the string is empty for the ASP.NET development server ("Casini").

NB,这个字符串对于ASP是空的。网络开发服务器(“极”)。

#3


3  

@AnthonyWJones "So the question becomes, How does an ASP.NET application determine what operating system it is running on?"

所以问题变成了,ASP如何。NET应用程序确定它在哪个操作系统上运行?

You can use System.Environment.OSVersion

您可以使用System.Environment.OSVersion

#4


2  

The version number can be queried from the Windows Registry:

版本号可从Windows注册中心查询:

On windows, run regedit and navigate to this directory:

在windows上,运行regedit并导航到以下目录:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\VersionString  

Mine returns Version 6.0 because I am running Windows 2003 Server.

我的返回版本6,因为我正在运行Windows 2003服务器。

#5


0  

I saw someone already answered to a degree, but I did want to mention that the best practice is to include your .NET target environment into your ASP.NET application. This way the target environment will be present.

我看到有人已经在一定程度上回答了这个问题,但是我想说的是,最好的实践是将。net目标环境包含到您的ASP中。网络应用程序。这样,目标环境就会出现。

#1


13  

To get the IIS version of the webserver you can use the SERVER_SOFTWARE server variable.

要获得webserver的IIS版本,可以使用SERVER_SOFTWARE server变量。

Request.ServerVariables["SERVER_SOFTWARE"];

It will return something like as follows:

它将返回如下内容:

Microsoft-IIS/5.0 (Windows 2000)

microsoft iis / 5.0(Windows 2000)

Microsoft-IIS/5.1 (Windows XP)

microsoft iis / 5.1(Windows XP)

Microsoft-IIS/6.0 (Windows 2003 Server)

microsoft iis / 6.0(Windows 2003服务器)

You can find a full reference of server variables here.

您可以在这里找到服务器变量的完整引用。

#2


9  

This is available directly from the SERVER_SOFTWARE server variable:

这可以直接从SERVER_SOFTWARE server变量获得:

HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"];

which is a string like "Microsoft-IIS/7.0".

它是一个类似于“Microsoft-IIS/7.0”的字符串。

NB, the string is empty for the ASP.NET development server ("Casini").

NB,这个字符串对于ASP是空的。网络开发服务器(“极”)。

#3


3  

@AnthonyWJones "So the question becomes, How does an ASP.NET application determine what operating system it is running on?"

所以问题变成了,ASP如何。NET应用程序确定它在哪个操作系统上运行?

You can use System.Environment.OSVersion

您可以使用System.Environment.OSVersion

#4


2  

The version number can be queried from the Windows Registry:

版本号可从Windows注册中心查询:

On windows, run regedit and navigate to this directory:

在windows上,运行regedit并导航到以下目录:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\VersionString  

Mine returns Version 6.0 because I am running Windows 2003 Server.

我的返回版本6,因为我正在运行Windows 2003服务器。

#5


0  

I saw someone already answered to a degree, but I did want to mention that the best practice is to include your .NET target environment into your ASP.NET application. This way the target environment will be present.

我看到有人已经在一定程度上回答了这个问题,但是我想说的是,最好的实践是将。net目标环境包含到您的ASP中。网络应用程序。这样,目标环境就会出现。