INFO: WinInet Not Supported for Use in Services

ID: Q238425


The information in this article applies to:


SUMMARY

The Microsoft Win32 Internet Functions (exported from WinInet.dll) are not supported when run from a service or an Internet Information Server (IIS) application (also a service). This article discusses using the WinInet.dll in a service or in Internet Information Server applications.


MORE INFORMATION

Because IIS is a service, you will have the same set of problems running WinInet in an ISAPI Extension or in a COM DLL--ActiveX DLL used by Active Server Pages (ASP)--as in running WinInet in a service. Running WinInet in an IIS application also has a unique set of problems.

The problem with running WinInet in a service is that WinInet uses settings from the registry for SSL information, proxy information, and more. Services do not load the HKEY_CURRENT_USER registry hive, so this information is not available. The following Knowledge Base article addresses this issue:

Q190542 INFO: Using WinInet APIs in a System Service to Access SSL Sites
Warning: Microsoft does not support using WinInet APIs within the context of a System Service. However, an unsupported workaround is available. It should be noted that Microsoft does not support this workaround and the user must be aware that future releases of Windows NT and Internet Explorer may break this workaround.

WinInet APIs report access violations when used from the service over the SSL with Internet Explorer 5.0 installed.

In order to understand the limitations unique to using WinInet in a server environment, it is necessary to understand WinInet's history. WinInet was developed for use by Internet Explorer. In fact, to use later versions of WinInet, you must load a minimal installation of Internet Explorer (see the References section in this article). WinInet also exposes APIs for use by other client applications that wish to access resources on the Internet (or intranet). It is important to recognize the environment in which WinInet was developed and tested in order to understand the appropriate use for the DLL. WinInet was developed for use in a client environment. Although it is still acting as a client when it is running in an ISAPI DLL, it is running in a server environment in this case.

Client Environment: A Person Running the Internet Explorer Server Environment: a Web server (such as, www.microsoft.com) To build a component that is robust in a server environment, the component must be designed and tested with that goal in mind. While the WinInet.dll is a robust component, it was never intended to run in this environment. It is recommended that server applications that need to access resources on the Internet use the Window Sockets APIs. You can use the SSL Security Support Provider Interface (SSPI) directly with Windows Sockets to enable communication with HTTPS servers over the SSL encrypted connections.

Windows 2000 SDK Beta 2 includes a sample that demonstrates how to use the WinSock over the SSL. You'll find a sample in \mssdk\samples\winbase\security\ssl directory of the SDK.

Another problem to be aware of when using WinInet in a server environment is the two-connection limit imposed by Internet Explorer. This subject is covered in the following Knowledge Base article:
Q183110 WinInet Limits Connections Per Server
While is possible to use WinInet in a service and in a server environment, it is not recommended nor is it supported by Microsoft. WinInet has not been tested in this configuration and problems do exist.


REFERENCES

The information described in the article is summarized in the July 1999 MSDN, the Microsoft Developer Network:

Microsoft Win32 Internet Functions Overview
For more information, see the following article in the Microsoft Knowledge Base:
Q185375 HOWTO: Create a Single EXE Install of Internet Explorer

Additional query words:


Keywords          : kbIE401 kbIE500 kbGrpInetServer kbDSupport 
Version           : WINDOWS:4.01,5.0
Platform          : WINDOWS 
Issue type        : kbinfo 

Last Reviewed: August 9, 1999