惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
V
V2EX
S
Security Affairs
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
IT之家
IT之家
J
Java Code Geeks
The Register - Security
The Register - Security
U
Unit 42
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Cisco Talos Blog
Cisco Talos Blog
Project Zero
Project Zero
S
Schneier on Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
D
DataBreaches.Net
博客园 - 司徒正美
V
Vulnerabilities – Threatpost
T
Tor Project blog
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
小众软件
小众软件
L
LangChain Blog
Attack and Defense Labs
Attack and Defense Labs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Palo Alto Networks Blog
A
Arctic Wolf
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
L
LINUX DO - 最新话题
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
Engineering at Meta
Engineering at Meta

博客园 - codingsilence

更新部分字段 NHibernate 都是分号惹的祸(ORA-00911: invalid character) 降低Winform 内存占用 FARPOINT 常见用法 比较Double型数据时的注意事项 WinForm中获取鼠标当前位置 查看SQL Server日志 WinForm winform动态生成菜单 WinForm 从XML中动态加载菜单的示例 “轻松加愉快”地实现并使用IComparer接口 WinForm 选择器 C#程序实现动态调用DLL的研究 WCF 的 WebGet 方式 WCF WebGet WebInvoke WCF Jquery 调用 开源选型关注点 在64位Windows的IIS上开启32位程序支持(转) Oracle grant用户授权 ODP.NET开发和部署的相关问题 Client使用c#和odp.net连接server oracle
installshiled 创建iis应用程序池和站点
codingsilence · 2011-08-07 · via 博客园 - codingsilence

 ///////////////////////////////////////////////////////////////////////////////
// //
// Function: CreateVirDir //
// //
// Purpose: This function creates an IIS Virtual Directory //
// //
///////////////////////////////////////////////////////////////////////////////

function CreateVirDir(IISSite, SiteDir)
BOOL SiteExisted;
object objIIS_Root, objVirtDir, objAppPool, objIIS_WS, objSchedule;
STRING svAppPool, strMsg, svT, svHold, svCmd, svProg, svParms[500], svOut;
STRING szField1, svF1, svF2;
NUMBER svPoolStatus, nLineNum;

begin

svAppPool = "M5WebServices";

if @IFX_PRODUCT_NAME = "M5 Pages, Components and Help" then
svAppPool = "M5AppServices";
endif;

if (svIISVer = "6") then
if (SYSINFO.WINNT.bWinServer2003 = TRUE) then
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/AppPools", "");
if (IsObject(objIIS_Root)) then
try
set objAppPool = objIIS_Root.GetObject("IISApplicationPool", svAppPool);
svPoolStatus = TRUE;
catch
set objAppPool = objIIS_Root.Create("IISApplicationPool", svAppPool);
svPoolStatus = FALSE;
objAppPool.SetInfo();
endcatch;

if (IsObject(objAppPool)) then
// In minutes
objAppPool.PeriodicRestartTime = 1740;
if svAppPool = "M5WebServices" then
// In number of events
// objAppPool.PeriodicRestartRequests = 4000;
// In bytes
// objAppPool.PeriodicRestartMemory = 512000;
// In bytes
// objAppPool.PeriodicRestartPrivateMemory = 196608;
endif;
objAppPool.SetInfo();
endif;
set objAppPool = NOTHING;
set objIIS_Root = NOTHING;
endif;
endif;

set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
if (IsObject(objIIS_Root)) then
try
set objVirtDir = objIIS_Root.GetObject("IISWebVirtualDir", IISSite);
SiteExisted = TRUE;
catch
set objVirtDir = objIIS_Root.Create("IISWebVirtualDir", IISSite);
SiteExisted = FALSE;
endcatch;
if (IsObject(objVirtDir)) then
// Do not recreate the CrystalExports site in case the output
// for reports has been manually changed (file sharing in use
// multiple web servers.
if (IISSite = "CE_BIN" && SiteExisted) then
svLine = "Business Objects Exports Bin directory already exists. It will not be recreated.";
nResult = WriteLine(nvLogFileHandle, svLine);
elseif (IISSite = "Uploads" && SiteExisted) then
svLine = "Uploads directory already exists. It will not be recreated.";
nResult = WriteLine(nvLogFileHandle, svLine);
else
try
objVirtDir.Path = SiteDir;
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;
if (SYSINFO.WINNT.bWinServer2003 = TRUE) then
objVirtDir.AspMaxRequestEntityAllowed = 10485760; //10 MB
objVirtDir.AspBufferingLimit = 5242880; //5 MB
endif;
objVirtDir.AccessWrite = FALSE;
objVirtDir.AspEnableParentPaths = TRUE;
objVirtDir.EnableDirBrowsing = FALSE;
objVirtDir.AspScriptLanguage = "JScript";
objVirtDir.AppFriendlyName = IISSite;
objVirtDir.AppIsolated = 2;
objVirtDir.AspAllowSessionState = FALSE;
if (SYSINFO.WINNT.bWinServer2003 = TRUE) then
objVirtDir.AppPoolID = svAppPool;
endif;
objVirtDir.SetInfo();
objVirtDir.AppCreate(TRUE);
objVirtDir.SetInfo();
catch
svLine = "Unable to create Virtual Directory " + IISSite + ". You will have to create it manually.";
nResult = WriteLine(nvLogFileHandle, svLine);
endcatch;
endif;
endif;
endif;
else
// IIS 7 setup
// Check for the correct application pool first
svCmd = "cmd";
svProg = " /C " + WINDIR ^ "system32" ^ "inetsrv" ^ "appcmd.exe";
svOut = szAppPath ^ "m5iis.txt";
svT = ' list apppool /name:"' + svAppPool + '" >>' + svOut;
svParms = svProg + svT;
svLine = "Checking for " + svAppPool + " application pool";
nResult = WriteLine(nvLogFileHandle, svLine);
nResult = LaunchAppAndWait(svCmd, svParms, WAIT | LAAW_OPTION_HIDDEN);
if (FileGrep (svOut, svAppPool, szField1,
nLineNum, RESTART) != 0) then
svLine = "Need to create application pool " + svAppPool;
nResult = WriteLine(nvLogFileHandle, svLine);
svF1 = ' add apppool /name:"' + svAppPool + '" /managedRunTimeVersion:"v2.0" /managedPipelineMode:"Classic" ';
// svF2 = '/autoStart:"true" /recycling.periodicRestart.requests:"4000" /recycling.periodicRestart.time:"24:00:00" /recycling.periodicRestart.memory:"512000" /recycling.periodicRestart.privateMemory:"196608"';
svF2 = '/autoStart:"true"';
svT = svF1 + svF2;
svHold = svF1 + svF2;
svParms = svProg + svT;
svLine = "Creating " + svAppPool + " application pool";
nResult = WriteLine(nvLogFileHandle, svLine);
nResult = LaunchAppAndWait(svCmd, svParms, WAIT | LAAW_OPTION_HIDDEN);
svT = ' list apppool /name:"' + svAppPool + '" >>' + svOut;
svParms = svProg + svT;
nResult = LaunchAppAndWait(svCmd, svParms, WAIT | LAAW_OPTION_HIDDEN);
if (FileGrep (svOut, svAppPool, szField1,
nLineNum, RESTART) != 0) then
svLine = "Unable to create application pool " + svAppPool;
nResult = WriteLine(nvLogFileHandle, svLine);
svLine = " command used was " + svHold;
nResult = WriteLine(nvLogFileHandle, svLine);
bProblem = TRUE;
endif;
endif;
nResult = DeleteFile(svOut);
// Now add the IIS application
svCmd = "cmd";
svProg = " /C " + WINDIR ^ "system32" ^ "inetsrv" ^ "appcmd.exe";
svOut = szAppPath ^ "m5iis.txt";
svT = ' list app http://localhost/' + IISSite + '" >>' + svOut;
svParms = svProg + svT;
svLine = "Checking for " + IISSite + " IIS application";
nResult = WriteLine(nvLogFileHandle, svLine);
nResult = LaunchAppAndWait(svCmd, svParms, WAIT | LAAW_OPTION_HIDDEN);
if (FileGrep (svOut, IISSite, szField1,
nLineNum, RESTART) = 0) then
if (IISSite = "CE_BIN") then
svLine = "Business Objects Exports Bin directory already exists. It will not be recreated.";
nResult = WriteLine(nvLogFileHandle, svLine);
return 0;
elseif (IISSite = "Uploads") then
svLine = "Uploads directory already exists. It will not be recreated.";
nResult = WriteLine(nvLogFileHandle, svLine);
return 0;
endif;
endif;
svT = ' add app /site.name:"Default Web Site" /path:/' + IISSite + ' /physicalPath:' + SiteDir + ' /applicationPool:' + svAppPool;
svParms = svProg + svT;
svLine = "Creating IIS Application " + IISSite + " using paramters of " + svT;
nResult = WriteLine(nvLogFileHandle, svLine);
nResult = LaunchAppAndWait(svCmd, svParms, WAIT | LAAW_OPTION_HIDDEN);
nResult = DeleteFile(svOut);
endif;

return 0;
end;