In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use ASP.NET to operate the application in IIS7. It is very detailed and has a certain reference value. Friends who are interested must read it!
Create a virtual directory
When setting up a virtual directory, the default is "Default Web Site", that is, it is built on Default Web Site by default. CreateVdir requires two parameters: the virtual path name and the actual physical path.
Public static bool CreateVdir (string vdir, string phydir) {ServerManager serverManager = new ServerManager (); Site mySite = serverManager.Sites ["Default Web Site"]; mySite.Applications.Add ("/" + vdir, phydir); serverManager.CommitChanges (); return true;}
What is created here is a virtual directory under Default Web Site, and modify the above mysite to
Site mySite = iisManager.Sites.Add ("test", "http", "*: 80:" + WebName + ".intranet." + TLD, @ "c:\ Webs\" + WebName)
You can set up a website. The two differences are: you build a website. The previous visit indicates that URL is http://www.dotnetcms.org/book and the latter is http://book.dotnetcms.org
Next, create the application pool
Public static void CreateAppPool (string appPoolName) {try {ServerManager serverManager = new ServerManager (); serverManager.ApplicationPools.Add (appPoolName); ApplicationPool apppool = serverManager.ApplicationPools [appPoolName]; apppool.ManagedPipelineMode = ManagedPipelineMode.Classic; serverManager.CommitChanges (); apppool.Recycle ();} catch {}}
Here, the value ManagedPipelineMode.Classic;IIS7 of ManagedPipelineMode supports classical Classic mode and Interget integration mode, and in integration mode
Custom handler and Module may not work. If you want to be compatible with previous IIS5/6 versions, you can use Classic, otherwise it is recommended to use integration.
The following code demonstrates how to assign a virtual directory to an application pool. The difference from IIS5/6*** is that vdir is actually vdir path, so a "/" is added here to represent a virtual path.
Public static void AssignVDirToAppPool (string vdir, string appPoolName) {try {ServerManager serverManager = new ServerManager (); Site site = serverManager.Sites ["Default Web Site"]; site.Applications ["/" + vdir]. ApplicationPoolName = appPoolName; serverManager.CommitChanges ();} catch {}}
* add a delete operation
Public static bool DeleteVdir (string vDirName) {try {ServerManager serverManager = new ServerManager (); Site mySite = serverManager.Sites ["Default Web Site"]; Microsoft.Web.Administration.Application application = mySite.Applications ["/" + vDirName]; mySite.Applications.Remove (application); serverManager.CommitChanges (); return true;} catch {return false }} the above is all the contents of this article entitled "how to use ASP.NET to operate applications in IIS7". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.