大网数据广告活动
Web服务器与PHP

WebSocketModule isn't loaded in IIS 8.0

· 52CE 我爱测

This article provides resolutions to enable the WebSocket Protocol feature and avoid the WebSocketModule is not loaded error in IIS 8.0.

This article helps you resolve the error (WebSocketModule is not loaded) that occurs when the WebSocket Protocol feature isn't enabled in Microsoft Internet Information Services (IIS) 8.0.

Original product version:   Internet Information Services 8.0, ASP.NET on .NET Framework 4.5.2
Original KB number:   2778043

Symptoms

The following error message occurs when you try to communicate with a Windows Communication Foundation (WCF) service configured with NetHttpBinding (for WebSockets) or an ASP.NET website over WebSockets protocol when hosted in IIS 8.0:

The WebSocketModule is not loaded. Check if the WebSocket feature is installed and the WebSocketModule is enabled in the list of IIS modules (see https://go.microsoft.com/fwlink/?LinkId=231398 for details).

Cause

This problem can occur if the WebSocket Protocol feature isn't enabled in IIS 8.0.

Resolution

To resolve this problem, enable the WebSocket Protocol feature in IIS 8.0. To achieve this, choose one of the following options:

  1. From an administrative command prompt, run the following command:

    %SystemRoot%\system32\dism.exe /online /enable-feature /featurename:IIS-WebSockets
    
  2. To enable the WebSocket Protocol feature using the UI on Windows 8, navigate to Control Panel > Programs > Turn Windows features on or off > Internet Information Services > World Wide Web Services > Application Development Features > WebSocket Protocol.

  3. To enable the WebSocket Protocol feature using the UI on Windows Server 2012, navigate to Server Roles > Web Server (IIS) > Web Server > Application Development > WebSocket Protocol.

  4. To enable the WebSocket Protocol feature using a startup task in Azure:

    • Create a Startup.cmd file with the following command in the cloud service project:

      %SystemRoot%\system32\dism.exe /online /enable-feature /featurename:IIS-WebSockets
      
    • Set Build Action to None and set Copy to Output Directory to Copy Always on this Startup.cmd file.

    • Add the following in the ServiceDefinition.csdef file:

    <Startup>
        <Task commandLine="Startup.cmd"
        executionContext="elevated" taskType="simple"/>
    </Startup>
    

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 04/15/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。