Scenario: Build a Classic ASP Website on IIS (在Win8,Win server 2012中架设传统ASP网站)

来源:互联网 发布:怎么看python安装的库 编辑:程序博客网 时间:2024/06/04 23:18


原文链接:

http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8/scenario-build-a-classic-asp-website-on-iis


This document guides you through installing IIS and configuring a classic ASP website. Classic ASP is a server-side scripting environment that you can use to create and run dynamic web applications. With ASP, you can combine HTML pages, script commands, and COM components to create interactive web pages that are easy to develop and modify. Classic ASP is the predecessor to ASP.NET, but it is still in wide use today.


这篇文档指导你完整安装IIS和在IIS上配置传统的ASP网站。传统的ASP是一种服务器端脚本环境,它被用于创建和运行动态的Web应用。使用ASP,你能组合HTML页面、脚本命令、和COM组件,从而创建出交互的Web网页,这些交互的网页开发和修改是容易的。传统的ASP是ASP.Net的前身,但是它在今天仍然有非常广泛的使用。


The Classic ASP server configuration adds IIS modules for ASP and ISAPI extensions to the default IIS installation.

传统ASP服务器配置 要  增加  “IIS的ASP模块” 和“ISAPI扩展模块” 到  默认IIS安装,在IIS才会有相关配置。

In this document

  • Prerequisites (前期准备)
  • Step 1: Install the IIS Web Server (安装IIS Web服务器)
  • Step 2: Add a Classic ASP Website (增加一个传统的ASP网站)
  • Step 3: Edit ASP Application Settings (编辑ASP应用设置)
  • Next Steps  (下一步)

Prerequisites(前期准备)

To get the most from this tutorial, you must have access to a computer that is running one of the following operating systems:

  • Windows Server® 2012
  • Windows® 8

为了从这个教程获取到最多,你必须能够访问一个装了以下操作系统的电脑:        

  • Windows Server® 2012
  • Windows® 8

Step 1: Install the IIS Web Server (第一步:安装Web服务器)

You can use the Web Platform Installer (Web PI) to install IIS, and applications that run on IIS. Because the Web PI installs the latest versions of available Web Platform offerings, with just a few simple clicks you can download and install any new tools or updates. To learn more about the Web PI, see Learn more and install the Web PI.

You can also perform this procedure by using the Windows user interface (UI) or from a command line.


你可以使用Web PI来安装IIS和运行在IIS上的应用,Web PI能安装Web Platform提供最新版本可利用资源,仅需简单地点击你就能下载并且安装任何新工具或者更新。

为了学习更多关于Web PI的知识,参见 Learn more and install the Web PI.

你也可以通过使用Windows UI或者命令行来执行这些过程。

To install IIS on Windows Server 2012 by using the UI (使用UI在Windows Server 2012上安装IIS)

  1. On the Start page, click the Server Manager tile, and then click OK.    在开始页中,点击“服务器管理器”,然后点击“OK”。
  2. In Server Manager, select Dashboard, and click Add roles and features. 在“服务管理器”中,选择“仪表盘”,然后选择“添加角色和特性”
  3. In the Add Roles and Features Wizard, on theBefore You Begin page, clickNext. 在“添加角色和特性向导”中,在“你开始前”页面,点击“下一步”
  4. On the Select Installation Type page, selectRole-based or Feature-based Installation and clickNext    在“选择安装类型”页面,选择“基于角色或特征安装”,然后点击“下一步”
  5. On the Select Destination Server page, selectSelect a server from the server pool, select your server, and clickNext. 在“选择目标服务器”页中,选择“从服务器池中选择服务器”,选择你的服务器,然后点击“下一步“。
  6. On the Select Server Roles page, selectWeb Server (IIS), and then clickNext. 在”选择服务器角色“页中,选择”Web Server(IIS)“,然后点击”下一步“。
  7. On the Select Features page, note the preselected features that are installed by default, and then select the following additional role services:   
    • ASP
    • ISAPI Extensions
    • 在”选择特征“页,记得在默认勾选了的特征后,选择下面增加的角色服务:
    • ASP
    • ISAPI Extensions
  8. Click Next.  点击”下一步“
  9. On the Web Server Role (IIS) page, clickNext. 在”Web服务器角色(IIS)“页中,点击”下一步“
  10. On the Select Role Services page, note the preselected role services that are installed by default, and then clickNext. (Note: You only have to install the IIS 8 default role services for a static-content web server.)  在”选择角色服务“页,记得默认预选的角色服务,然后点击”下一步“。(注意:你仅需安装为静态内容web服务器安装IIS8的默认角色服务)
  11. On the Confirm Installation Selections page, confirm your selections, and then clickInstall. 在”确认安装选项“页面,确认你的选择,然后点击”安装“
  12. On the Installation Progress page, confirm that your installation of the Web Server (IIS) role and required role services completed successfully, and then clickClose. 在”安装进度“页面,确认你要安装的Web服务器(IIS)角色和需要的服务成功结束,然后点击”关闭“。
  13. To verify that IIS installed successfully, type the following into a web browser:  

    http://localhost

    You should see the default IIS Welcome page.

为了验IIS安装是否成功,在浏览器中地址栏中输入”http://localhost“,你应该可以看到IIS默认的欢迎页。

To install IIS on Windows 8 by using the UI (通过UI在Windows 8中安装IIS)

  1. On the Start page, type Control Panel, and then click the Control Panel icon in the search results.  在开始页中输入”Control Panel“,然后在查找结果中点击 控制面板图标
  2. In Control Panel, click Programs, and then click Turn Windows features on or off.  在控制面板中,点击”程序“,然后 点击”打开关闭Windows功能“
  3. In the Windows Features dialog box, clickInternet Information Services, note the preselected features that are installed by default, and then select the following additional role services: 
    • ASP
    • ISAPI Extensions

    • 在”Windows功能“对话框中,点击”Internet Information Services“,记得默认安装预选功能,然后选择下面的额外角色服务:ASP ,ISAPI Extensions。
  4. Click OK. 点击”确定“
  5. To verify that IIS installed successfully, type the following into a web browser:

    http://localhost

    You see the default IIS Welcome page.

在浏览器中输入”http://localhost“验证是否安装成功。

To Install IIS by using the command line (用命令行安装IIS)

Type the following command at a command prompt or into a script:

Start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-ASP;IIS-ISAPIExtensions;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-Security;IIS-RequestFiltering;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;IIS-ManagementConsole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI

Step 2: Add a Classic ASP Website(第二步:添加一个传统的ASP站点)

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

你可以通过用UI、命令行使用Appcmd.exe、直接编辑配置文件、或者写WMI脚本来完成这个过程,

To add a website by using the UI(通过UI添加Web站点)

  1. Open IIS Manager.
    • For Windows Server 2012, on the Start page click theServer Manager tile, and then clickOK. On theServer Manager Dashboard, click theTools menu, and then clickInternet Information Services (IIS) Manager.
    • For Windows 8, on the Start page typeControl Panel, and then click theControl Panel icon in the search results. On theControl Panel screen, click System and Security, clickAdministrative Tools, and thenclick Internet Information Services (IIS) Manager.
  2. In the Connections pane, right-click theSites node in the tree, and then clickAdd Website.
  3. In the Add Website dialog box, type a friendly name for your website in theSite name box.
  4. If you want to select a different application pool than the one listed in theApplication Pool box, clickSelect. In theSelect Application Pool dialog box, select an application pool from theApplication Pool list and then clickOK.
  5. In the Physical path box, type the physical path of the Web site's folder, or click the browse button (...) to navigate the file system to find the folder.
  6. If the physical path that you entered in step 5 is to a remote share, click Connect as to specify credentials that have permission to access the path. If you do not use specific credentials, select theApplication user (pass-through authentication) option in theConnect As dialog box.
  7. Select the protocol for the Web site from the Type list.
  8. The default value in the IP address box isAll Unassigned. If you must specify a static IP address for the Web site, type the IP address in theIP address box.
  9. Type a port number in the Port text box.
  10. Optionally, type a host header name for the Web site in the Host Header box.
  11. If you do not have to make any changes to the site, and you want the Web site to be immediately available, select theStart Web site immediately check box.
  12. Click OK.

To add a website by using the command line (通过命令行添加站点)

Use the following syntax at the command prompt or in a script: (Note: For this syntax to work, you either must be in the following directory, or have the directory in your path:%windir%\system32\inetsrv.)

appcmd add site /name:string /id:uint /physicalPath:string /bindings:string

The variable name:string is the name, and the variableid:uint is the unsigned integer that you want to assign to the site. The variablesname:string and id:uint are the only variables that are required when you add a site in Appcmd.exe. (Note: When you add a site without specifying the values for the bindings and physicalPath attributes, the site will not be able to start.)

The variable physicalPath:string is the path of the site content in the file system.

The variable bindings:string contains information that is used to access the site, and it should be in the form ofprotocol/IP_address:port:host_header. For example, a web site binding is the combination of protocol, IP address, port, and host header. A binding ofhttp/*:85: enables a web site to listen for HTTP requests on port85 for all IP addresses and domain names (also known as host headers or host names). On the other hand, a binding ofhttp/*:85:marketing.contoso.com configures a website to listen for HTTP requests on port85 for all IP addresses and for the domain namemarketing.contoso.com.

To add a web site named contoso with an ID of 2 that has content inc:\contoso, and that listens for HTTP requests on port 85 for all IP addresses and a domain name ofmarketing.contoso.com, type the following at the command prompt, and then press ENTER:

appcmd add site /name: contoso /id:2 /physicalPath: c:\contoso /bindings:http/*:85: marketing.contoso.com

Step 3: Edit ASP Application Settings (第三步:编辑ASP应用设置)

IIS 8 provides default settings for ASP applications, but you can change those settings as needed. For example, you can enable client-side debugging on a test server to aide in troubleshooting issues during a test pass.

To edit ASP application settings by using the UI (用UI编辑ASP应用设置)

  1. Open IIS Manager and navigate to the level you want to manage.
  2. In Features View, double-click ASP.
  3. On the ASP page, edit settings as desired.
  4. When finished, click Apply in the Actions pane.

To edit ASP application settings by using the command line(用命令行编辑ASP应用设置)

Specify default character set(定义默认字符集)

To specify the default character set for an application, use the following syntax:

appcmd set config /section:asp /codePage:integerRange

The variable integerRange is the default character set. For example, to set the code page to a Latin character set used in American English and many European alphabets, type the following at the command prompt, and then press Enter:

appcmd set config /section:asp /codePage:1252

Enable or disable buffering(启用或禁用缓存)

To enable or disable buffering of ASP application output, use the following syntax:

appcmd set config /section:asp /bufferingOn:true|false

A value of true enables buffering whereasfalse disables buffering. The default value istrue.

Enable or disable HTTP 1.1 chunked transfer encoding (启用或禁用HTTP1.1快传输编码)

To enable HTTP 1.1 chunked transfer encoding for the World Wide Web publishing service, use the following syntax:

appcmd set config /section:asp /enableChunkedEncoding:true|false

A value of true enables HTTP 1.1 chunked transfer encoding whereasfalse disables HTTP 1.1 chunked transfer encoding. The default value istrue.

Enable or disable HTML fallback (启用或禁用HTML回退)

To enable or disable HTML fallback, use the following syntax:

appcmd set config /section:asp /enableASPHTMLFallback:true|false

A value of true causes an .htm file that has the same name as the requested .asp file, if it exists, to be sent instead of the .asp file if the request is rejected because of a full request queue. The default value is true.

Enable or disable parent paths(启用或禁用父目录)

To enable or disable paths relative to the current directory or above the current directory, use the following syntax:

appcmd set config /section:asp /enableParentPaths:true|false

A value of true sets ASP pages to allow paths relative to the current directory or above the current directory. The default value istrue.

Set client connection test interval(设置客户端连接测试间隔)

To set a time interval after which ASP will check to see whether the client is still connected before executing a request, use the following syntax:

appcmd set config /section:asp /queueConnectionTestTime:timeSpan

The variable timeSpan sets the time interval (hh:mm:ss) after which ASP checks to see whether the client is still connected before executing a request. The default value is00:00:03.

Set maximum requesting entity body limit(设置最大请实体上限)

To specify the maximum number of bytes allowed in the entity body of an ASP request, use the following syntax:

appcmd set config /section:asp /maxRequestEntityAllowed:int

The variable int represents the maximum number of bytes allowed in the body of an ASP request. The default value is200000 bytes.

Set request queue length (设置请求队列长度)

To specify the maximum number of concurrent ASP requests allowed into the queue, use the following syntax:

appcmd set config /section:asp /requestQueueMax:int

The variable int represents the maximum number of concurrent ASP requests that are allowed into the request queue. The default value is3000.

Set request queue time-out (设置请求队列超时)

To specify the period that an ASP request can wait in the request queue, use the following syntax:

appcmd set config /section:asp /queueTimeout:timeSpan

The variable timeSpan represents the maximum time (hh:mm:ss) that an ASP request can wait in the request queue. The default value is00:00:00.

Specify response buffering limit (定义响应缓存大小)

To control the maximum number of bytes that an ASP page can write to the response buffer before a flush occurs, use the following syntax:

appcmd set config /section:asp /bufferingLimit:int

The variable int represents the maximum size, in bytes, of the ASP buffer. The default value is4194304 bytes.

Set script time-out (设置脚本超时)

To specify the default length of time that ASP pages let a script run before terminating the script and writing an event to the Windows Event Log, use the following syntax:

appcmd set config /section:asp /scriptTimeout:timeSpan

The variable timeSpan represents the maximum time (hh:mm:ss) that an ASP request can run before an event is written to the Windows Event Log. The default value is00:01:30.

Specify threads per processor limit (定义ASP能在每个处理器上创建的最大线程数)

To specify the maximum number of worker threads per processor that ASP can create, use the following syntax:

appcmd set config /section:asp /processorThreadMax:int

The variable int represents the maximum number of worker threads per processor that ASP can create. The default value is25.

Specify default locale identifier(定义默认本地化标识符)

To define how dates, times, and currencies are formatted for an ASP application, use the following syntax:

appcmd set config /section:asp /lcid:int

The variable int represents the default locale identifier for an ASP application. The default value is0.

Enable or disable automatic application restart (启用或禁用应用自动重启)

To enable or disable automatic restart of ASP applications whenever a configuration setting is changed, use the following syntax:

appcmd set config /section:asp /enableApplicationRestart:true|false

A value of true enables ASP applications to be automatically restarted whenever a configuration setting is changed. The default value istrue.

Enable or disable line number calculation(启用或禁用行号计算)

To enable or disable ASP to calculate and store the line number of each executed line of code to provide the number in an error report, use the following syntax:

appcmd set config /section:asp /calLineNumber:true|false

A value of true enables line number calculation and storage. The default value istrue.

Enable or disable COM component exception trapping (启用或禁用COM组件异常跟踪)

To enable or disable ASP pages to catch exceptions thrown by COM components, use the following syntax:

appcmd set config /section:asp /exceptionCatchEnable:true|false

A value of true enables COM component exception trapping. If set tofalse, the Microsoft Script Debugger tool does not catch exceptions sent by the component that you are debugging. The default value istrue.

Enable or disable client-side debugging(启用或禁用客户端调试)

To enable or disable client-side debugging, use the following syntax:

appcmd set config /section:asp /appAllowClientDebug:true|false

A value of true enables client-side debugging. The default value isfalse.

Enable or disable log error requests(启用或禁用记录错误请求)

To enable or disable the writing of ASP errors to the application section of the Windows event log, use the following syntax:

appcmd set config /section:asp /logErrorRequests:true|false

A value of true enables log error requests. By default, ASP errors are written to the client browser and the IIS logs. The default value istrue.

Enable or disable Windows event logging of ASP errors (启用或禁用ASP错误到Windows事件日志)

To enable or disable ASP debugging on the server, use the following syntax:

appcmd set config /section:asp /appAllowDebugging:true|false

A value of true enables server-side debugging for ASP applications. The default value isfalse.

Run On End Functions Anonymously  (运行匿名End函数)

To enable or disable SessionOnEnd and ApplicationOnEnd global ASP functions to run as the anonymous user, use the following syntax:

appcmd set config /section:asp /runOnEndAnonymously:true|false

A value of true enables SessionOnEnd and ApplicationOnEnd global ASP functions to run as the anonymous user. The default value istrue.

Specify script error message (定义脚本错误信息)

To specify the error message to send to the browser if specific debugging errors are not sent to the client, use the following syntax:

appcmd set config /section:asp /scriptErrorMessage:string

The variable string represents the error message that is sent to the browser when specific debugging errors are not sent to the client. The default value is "An error occurred on the server when processing the URL. Please contact the system administrator".

Enable or disable sending errors to the browser (启用或禁用向浏览器发送错误)

To enable or disable the writing of debugging specifics (file name, error, line number, and description) to the client browser in addition to logging them to the Windows event log, use the following syntax:

appcmd set config /section:asp /scriptErrorSentToBrowser:true|false

A value of true enables the writing of debugging specifics to the client browser. The default value isfalse.

Specify default script language (定义默认的脚本语言)

To specify the default script language for all ASP applications that are running on the web server, use the following syntax:

appcmd set config /section:asp /scriptLanguage:string

The variable string represents the default script language. The default value isVBScript.

Specify cache directory path (定义缓存目录路径)

To specify the name of the directory where ASP stores compiled ASP templates when the in-memory cache overflows, use the following syntax:

appcmd set config /section:asp /diskTemplateCacheDirectory:string

The variable string represents the cache directory path. The default value is%windir%\system32\inetsrv\ASP Compiled Templates.

Enable or disable type library caching(启用或禁用类型库缓存)

To enable or disable the caching of type libraries, use the following syntax:

appcmd set config /section:asp /enableTypelibCache:true|false

A value of true enables the caching of type libraries. The default value istrue.

Set maximum number of compiled ASP templates to store(设置存储编译的ASP模板的最大数)

To set the maximum number of compiled ASP templates that can be stored, use the following syntax:

appcmd set config /section:asp /maxDiskTemplateCacheFiles:int

The variable int represents the maximum number of compiled ASP templates to store. The default value is2000.

Set maximum number of compiled ASP templates to store

To set the maximum number of precompiled script files to cache, use the following syntax:

appcmd set config /section:asp /scriptFileCacheSize:int

The variable int represents the number of precompiled script files to cache. If set to 0, no script files are cached. If set to4294967295, all requested script files are cached. The default value is500.

Set maximum number of scripting engines to cache(设置缓存脚本引擎的最大数)

To set the maximum number of scripting engines that ASP pages keep cached in memory, use the following syntax:

appcmd set config /section:asp /scriptEngineCacheMax:int

The variable int represents the maximum number of scripting engines that are cached. The default value is250.

Enable or disable COM+ side-by-side assemblies()

To enable or disable side-by-side COM+ assemblies, which allow ASP applications to specify which version of a system DLL or classic COM component to use, use the following syntax:

appcmd set config /section:asp /appServiceFlags:true|false

A value of true enables COM+ side-by-side assemblies. The default value isfalse.

Enable or disable COM+ tracker

To enable or disable COM+ tracker, use the following syntax:

appcmd set config /section:asp /enableTypelibCache:true|false

A value of true enables COM+ tracker, which lets administrators or developers debug ASP applications. The default value isfalse.

Enable or disable multithreaded environments

To enable or disable ASP to run in a multithreaded environment, use the following syntax:

appcmd set config /section:asp /executeInMta:true|false

A value of true enables ASP to run in a multithreaded environment. The default value isfalse.

Enable or disable thread model checking

To enable or disable whether IIS checks the threading model of any component that your application creates, use the following syntax:

appcmd set config /section:asp /trackThreadingModel:true|false

A value of true enables thread model checking. The default value isfalse.

Specify COM+ partition ID

To specify the Globally Unique Identifier (GUID) of the COM+ partition, use the following syntax:

appcmd set config /section:asp /partitionID:string

The variable string represents the GUID of the COM+ partition. The default value is00000000-0000-0000-0000-000000000000. (Note: You must also set theappServiceFlags flag to true.)

Specify COM+ application

To specify the name of the COM+ application, use the following syntax:

appcmd set config /section:asp /sxsName:string

The variable string represents name of the COM+ application. (Note: You must also set theappSeviceFlags flag totrue.)

Enable or disable COM+ partitioning

To enable or disable COM+ partitioning, use the following syntax:

appcmd set config /section:asp /appServiceFlags:true|false

A value of true enables COM+ partitioning, which can be used to isolate applications in their own COM+ partition. The default value isfalse. (Note: If set totrue, you must also set a value for thepartitionID property.)

Enable or disable session state(启用或禁用会话状态)

To enable or disable session state persistence for an ASP application, use the following syntax:

appcmd set config /section:asp /allowSessionState:true|false

A value of true enables session state persistence. The default value istrue.

Set maximum number of concurrent sessions(设置并发会话的最大数)

To set the maximum number of concurrent sessions that ASP allows, use the following syntax:

appcmd set config /section:asp /max:int

The variable int represents the maximum number of concurrent sessions. The default value is-1.

Enable or disable secure session ID(启用或禁用安全会话ID)

To enable or disable the sending of a session ID as a secure cookie if assigned over a secure session channel, use the following syntax:

appcmd set config /section:asp /keepSessionIdSecure:true|false

A value of true enables secure session ID. The default value istrue.

Set session time-out(设置会话超时)

To specify the default time that a session object is maintained after the last request associated with the object is made, use the following syntax:

appcmd set config /section:asp /timeout:timeSpan

The variable timeSpan represents the maximum time (hh:mm:ss) that a session object is maintained after the last request associated with the object is made. The default value is00:20:00.

Next Steps

Test your website thoroughly to ensure that it functions as expected. Then consider configuring the following features:

  • To help you troubleshoot or optimize the performance of your web server, set up IIS logging. For instructions see,Configure Logging in IIS.
  • To improve the security of your web server, configure request filtering. For instructions see,Configure Request Filtering in IIS.


0 0
原创粉丝点击