2025-11-28 00:35:46 +09:00

336 lines
14 KiB
HTML
Raw Permalink Blame History

<head>
<title>IIS Samples - ISAPI Input/Output Operations</title>
</head>
<body>
<a name="top"></a>
<p>
<h2>IIS Samples - ISAPI Input/Output Operations</h2>
<a name="IIS_IO_Operations"></a>
<p>This readme file is for all of the ISAPI I/O samples. These samples illustrate the different ways to
handle I/O within an ISAPI extension.</p>
<p>The <b>Asynchronous Read</b> sample demonstrates asynchronous ReadClient functionality in the ISAPI interface.
The <b>Asynchronous Trans</b> sample demonstrates asynchronous TransmitFile functionality in the ISAPI interface.
The <b>Asynchronous Write</b> sample demonstrate asynchronous WriteClient functionality in the ISAPI interface.
The <b>Synchronous Read</b> sample demonstrates synchronous ReadClient functionality in the ISAPI interface.
The <b>Synchronous Write</b> sample demonstrate synchronous WriteClient functionality in the ISAPI interface.
</p>
<p><font color="blue"><b>Important</b></font> &nbsp; These samples are provided for educational purposes only. They are not
intended to be used in a production environment, have not been tested in a production
environment, and Microsoft does not provide technical support for them.
<p>
&nbsp;</p>
<p>
<a href="#ovr">Sample Overview</a><br>
<a href="#req">Requirements</a><br>
<a href="#loc">Location of the Source Code</a><br>
<a href="#bld">Build and Install the Sample</a><br>
<a href="#run">Run the Sample</a><br>
<a href="#out">Sample Output</a><br>
<a href="#hlp">Helpdesk</a></p>
<p>
&nbsp;</p>
<h4><a name="ovr"></a>Sample Overview</h4>
<p>ISAPI 1.0 support synchronous IO operations via callback
methods ReadClient() and WriteClient(). The ability to
support asynchronous operations is important; it frees
up a server pool thread from being blocked to complete
the IO operation. In addition, IIS server engine already
has built in support to manage asynchronous IO operations
using the completion ports and server thread pool. </p>
<p>ISAPI 2.0 supports asynchronous write operation using
the existing callback function WriteClient() with a special
flag indicating that the operation has to be performed
asynchronously. In addition, ISAPI 2.0 also provides a
mechanism to request the server to transmit a file using
the TransmitFile() .</p>
<p>ISAPI 3.0 supports asynchronous read operation from the
client using ServerSupportFunction() with HSE_REQ_ASYNC_READ_CLIENT
and a special flag indicating that the operation has to be
performed asynchronously. In addition, the ISAPI application
should submit a callback function and context by calling
ServerSupportFunction() with HSE_REQ_IO_COMPLETION.</p>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="req"></a>Requirements</h4>
<p>This sample requires the installation of the following software to
function properly:</p>
<ul>
<li>Windows XP Professional with IIS 5.1 installed or Windows XP Server with
IIS 6.0 installed.</li>
</ul>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="loc"></a>Location of the Source Code</h4>
<p>IIS samples are included in the IIS Software Developer Kit (SDK).
You can download the IIS SDK from
<a href="http://go.microsoft.com/fwlink/?LinkId=7298">Platform SDK Update</a>.
You can view the SDK at <a href="http://go.microsoft.com/fwlink/?LinkId=1694">MSDN Online</a>.
In the table of contents at MSDN Online, click <b>Web Development</b>, <b>Server Technologies</b>,
<b>Internet Information Services (IIS)</b>, <b>SDK Documentation</b>,
<b>Internet Information Services</b>, <b>Samples</b>.</p>
<p>The following source code files are required for the <b>Asynchronous Read</b> sample:</p>
<table border="1">
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>AReadCli.sln</td>
<td>AReadCli Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>AReadCli.vcproj</td>
<td>AReadCli Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>AReadCli.dsp, AReadCli.dsw</td>
<td>AReadCli Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.</td>
</tr>
<tr>
<td>AReadCli.c</td>
<td>AReadCli source module containing the code that implements the sample.</td>
</tr>
<tr>
<td>AReadCli.def</td>
<td>AReadCli.dll definition containing code for creating the sample.</td>
</tr>
<tr>
<td>MAKEFILE</td>
<td>AReadCli makefile for command line compilation</td>
</tr>
</table><br>
<p>The following source code files are required for the <b>Asynchronous Trans</b> sample:</p>
<table border="1">
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>FTrans.sln</td>
<td>FTrans Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FTrans.vcproj</td>
<td>FTrans Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FTrans.dsp, FTrans.dsw</td>
<td>FTrans Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.</td>
</tr>
<tr>
<td>FTrans.c, OpenF.c</td>
<td>FTrans source modules containing the code that implements the sample.</td>
</tr>
<tr>
<td>FTrans.def</td>
<td>FTrans.dll definition containing code for creating the sample.</td>
</tr>
<tr>
<td>OpenF.h</td>
<td>FTrans header file containing commonly called routines.</td>
</tr>
<tr>
<td>MAKEFILE</td>
<td>FTrans makefile for command line compilation</td>
</tr>
</table><br>
<p>The following source code files are required for the <b>Asynchronous Write</b> sample:</p>
<table border="1">
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>FWAsych.sln</td>
<td>FWAsych Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FWAsych.vcproj</td>
<td>FWAsych Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FWAsych.dsp, FWAsych.dsw</td>
<td>FWAsych Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.</td>
</tr>
<tr>
<td>FWAsych.c, OpenF.c</td>
<td>FWAsych source modules containing the code that implements the sample.</td>
</tr>
<tr>
<td>FWAsych.def</td>
<td>FWAsych.dll definition containing code for creating the sample.</td>
</tr>
<tr>
<td>OpenF.h</td>
<td>FWAsych header file containing commonly called routines.</td>
</tr>
<tr>
<td>MAKEFILE</td>
<td>FWAsych makefile for command line compilation</td>
</tr>
</table><br>
<p>The following source code files are required for the <b>Synchronous Read</b> sample:</p>
<table border="1">
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>ReadCli.sln</td>
<td>ReadCli Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>ReadCli.vcproj</td>
<td>ReadCli Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>ReadCli.dsp, ReadCli.dsw</td>
<td>ReadCli Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.</td>
</tr>
<tr>
<td>ReadCli.c</td>
<td>ReadCli source modules containing the code that implements the sample.</td>
</tr>
<tr>
<td>ReadCli.def</td>
<td>ReadCli.dll definition containing code for creating the sample.</td>
</tr>
<tr>
<td>MAKEFILE</td>
<td>ReadCli makefile for command line compilation</td>
</tr>
</table><br>
<p>The following source code files are required for the <b>Synchronous Write</b> sample:</p>
<table border="1">
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>FWrite.sln</td>
<td>FWrite Visual Studio .NET solution file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FWrite.vcproj</td>
<td>FWrite Visual Studio .NET C Project file, required to build this sample in Visual Studio .NET.</td>
</tr>
<tr>
<td>FWrite.dsp, FWrite.dsw</td>
<td>FWrite Visual Studio 6.0 project files, required to build this sample in Visual Studio Version 6.</td>
</tr>
<tr>
<td>FWrite.c, OpenF.c</td>
<td>FWrite source modules containing the code that implements the sample.</td>
</tr>
<tr>
<td>FWrite.def</td>
<td>FWrite.dll definition containing code for creating the sample.</td>
</tr>
<tr>
<td>OpenF.h</td>
<td>FWrite header file containing commonly called routines.</td>
</tr>
<tr>
<td>MAKEFILE</td>
<td>FWrite makefile for command line compilation</td>
</tr>
</table><br>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="bld"></a>Build and Install the Sample</h4>
<p>To build this sample using the Visual C++ IDE, the following
steps must be performed:</p>
<ol>
<li>Open the solution (VS.NET) or desktop (VS6) file to open the project.</li>
<li>Click <b>Build</b> to create the DLL.</li>
</ol>
<p>To build and run this sample without using the Visual C++ IDE, the
following steps must be performed:</p>
<ol>
<li>Type <b>NMAKE All</b> from the command line. For example, if your sample files are located in
a folder called <code>C:\MySamples</code>, type the following at the command line:
<pre>cd /d c:\MySamples
NMAKE All</pre>
</li>
</ol>
<p>&nbsp;</p>
<p>To install this sample, the following steps must be performed:</p>
<ol>
<li>Copy the compiled .dll files to a physical folder on your computer. For example,
create a folder called <code>C:\Samples</code> and copy the files to that folder.</li>
<li>Create a virtual directory that maps to the physical folder containing your files. To create
a virtual directory, open the Internet Information Services (IIS) Manager by clicking <b>Start</b>,
<b>Run</b>, type <code>inetmgr</code> in the text box and click <b>OK</b>. Right-click on the Web
site where you want to create a virtual directory, click <b>New</b>, and click <b>Virtual
Directory</b>. In the <b>Alias</b> text box, type the name you want for your virtual directory, for
example, <code>InputOutput</code>. In the <b>Directory</b> text box, type the path to the
folder that contains your files.
<li>Configure strong security on your new virtual directory. Right-click the virtual directory name,
click <b>Properties</b>, and click the <b>Directory Security</b> tab. Press F1 for tips on
securing your virtual directory.</li>
<li>Use Windows Explorer to set restricted access control on the sample .dll file in its physical folder.
For more information, click <b>Start</b>, <b>Help and Support</b>, and search for <b>Access Control</b>.</li>
</ol>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="run"></a>Run the Sample</h4>
<p>In order to run this sample, follow the instructions listed below:</p>
<ol>
<li>Copy a file that you want to transfer to any physical folder on your computer, provided that the
folder is mapped to a virtual directory. For example, if you have an image file called
<code>sample.gif</code>, copy it to the same folder that contains your compiled .dll files since you
already mapped that folder to a virtual directory.</li>
<li>In Internet Explorer (IE), browse to each .dll as if it were a Web file, and pass in a query
string containing the name of a file to transfer. For example, if the
file you want to transfer is called <code>sample.gif</code>, and it is in the same folder as
your sample .dll files, and that folder is mapped to a virtual directory called
<code>InputOutput</code>, type one of the following in the address bar of IE, depending on which
sample you want to view:
<pre>http://localhost/InputOutput/AReadCli.dll
http://localhost/InputOutput/FTrans.dll?/InputOutput/sample.gif
http://localhost/InputOutput/FWAsync.dll?/InputOutput/sample.gif
http://localhost/InputOutput/ReadCli.dll
http://localhost/InputOutput/FWrite.dll?/InputOutput/sample.gif
</pre>
</li>
</ol>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="out"></a>Sample Output</h4>
<p>The following output is displayed somewhere after you perform step 2 from <b>Run the Sample</b>.</p>
<font size="2"><a href="#top">to top</a></font>
<p>&nbsp;</p>
<h4><a name="hlp"></a>Help Desk</h4>
<p>If here you do not find answers to your questions, visit the
<a href="http://go.microsoft.com/fwlink/?linkid=1782">Microsoft Help and Support</a>
Web site.</p>
<table border="1">
<tr>
<th>Problem</th>
<th>Possible Solution</th>
</tr>
<tr>
<td>When building the dll, C++ or VB returns the a permissions error.</td>
<td>Once you have called the dll from your web page, your system considers
it a loaded dll. You must unload it to build it again, either by
unloading the ASP application or deleting the dll from system32\dllcache.</td>
</tr>
<tr>
<td>When browsing to the dll, IE gives you a permissions error.</td>
<td>The folder and virtual directory must have Execute permissions set on them.</td>
</tr>
</table><br>
<font size="2"><a href="#top">to top</a></font>
<hr class="iis" size="1">
<p align="center"><i><EFBFBD> 1997-2002 Microsoft Corporation. All rights reserved.</i></p>
</body>
</html>