Get the App
SLTechnology News&Howtos  ›  Development  › 

How to modify the ASP.NET version of the IIS directory

Shulou Source: shulou.com Published: 2022-06-02 13:06:02 10月16日 Update

This article will explain in detail how to modify the ASP.NET version of the IIS directory. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

An ASP.NET version method for modifying virtual directories

ASP.NET IIS Registration tool

Using the ASP.NETIIS Registration tool (Aspnet_regiis.exe), you can easily update the script mapping of an ASP.NET application to point to the ASP.NET version associated with the tool.

For more details on the ASP.NETIIS registration tool, please refer to MSDN.

On the console, we can modify the Asp.Net version of a virtual directory using the following command:

Aspnet_iis.exe-spath

Now that we know how to modify the version of a virtual directory, the problem now is how to use the program to implement it.

The following code is compiled in WindowsXpsp2 based on .NetFrameWork2.0:

/ / create a virtual directory DirectoryEntrydirRoot=newDirectoryEntry ("IIS://localhost/W3SVC/1/Root"); DirectoryEntriesdirs=dirRoot.Children; DirectoryEntryvirtualDir=dirs.Add ("VirtualChange", dirRoot.SchemaClassName); object [] objs=newobject [] {true}; virtualDir.Invoke ("AppCreate", objs); virtualDir.Properties ["AppFriendlyName"] [0] = "VirtualChange"; virtualDir.Properties ["Path"] .value = "C:\\ VirtualChange"; virtualDir.CommitChanges () / / start the aspnet_iis.exe program stringfileName=Environment.GetEnvironmentVariable ("windir") + @ "\ Microsoft.NET\ Framework\ v1.1.4322\ aspnet_regiis.exe"; ProcessStartInfostartInfo=newProcessStartInfo (fileName); / / process the directory path stringpath=virtualDir.Path.ToUpper (); intindex=path.IndexOf ("W3SVC"); pathpath=path.Remove (0quotient index); / / start the aspnet_iis.exe program to refresh the textbook mapping startInfo.Arguments= "- s" + path; startInfo.WindowStyle=ProcessWindowStyle.Hidden; startInfo.UseShellExecute=false StartInfo.CreateNoWindow=true; startInfo.RedirectStandardOutput=true; startInfo.RedirectStandardError=true; Processprocess=newProcess (); process.StartInfo=startInfo; process.Start (); process.WaitForExit (); stringerrors=process.StandardError.ReadToEnd (); if (errorsfilling stringing.empty) thrownewException (errors); Console.WriteLine (process.StandardOutput.ReadToEnd ())

The ASP.NET version of the IIS directory was modified successfully

On "how to modify the ASP.NET version of the IIS directory" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Tags: Catalogs versions tools programs articles content more references good practical success code commands that is applications pointing teaching books articles methods knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Xiaomi MariaDB vpn Microsoft