在IIS7中启用net.tcp

Jay*_*esh 60 iis-7 net.tcp

如何让IIS处理net.tcp连接?

Ron*_*erg 120

您需要添加net.tcp到站点的已启用协议.转到IIS管理器,右键单击您的网站,转到"管理网站"或"管理应用程序",然后转到"高级设置...".在那里你看到'启用协议'.它可能会说http.将其更改为http,net.tcp.

如果要配置绑定,请右键单击您的网站并转到"编辑绑定...".默认的net.tcp绑定是808:*.

如果要在net.tcp后面使用IIS托管的WCF服务,您可能还需要检查是否已激活所需的Windows功能.转到Windows功能并检查是否已激活"Windows Communication Foundation非HTTP激活"(位于"Microsoft .NET Framework 3.5.1"下).

激活此功能后,您将获得一些额外的Windows服务.如果它仍然不起作用,请检查名为"Net.Tcp Listener Adapter"的Windows服务是否正在运行(应该自动启动,但有时它不会启动,这是我检查其中一个net.tcp服务停止工作时的第一个地方).

  • 我想你要么找错了地方,要么你没有足够的权利做这件事(虽然我从来没有听说过这个)或者你可能没有启用所需的Windows功能(也许'启用协议'选项不是如果您尚未启用"Windows Communication Foundation非HTTP激活",则可见,尽管这似乎不太可能). (3认同)
  • 如果您不希望任何http(s)流量到IIS,这将有效. (2认同)
  • 我遇到的问题是Net.Tcp监听器适配器服务无法完成启动...它只会挂起.添加'Windows Communication Foundation非HTTP激活'解决了这个问题......不明白为什么,但是谢谢:) (2认同)

Gav*_*vin 8

这可能有助于将来的某些人.powershell如果您需要自动创建绑定,我创建了一个非常有用的脚本.

它将自动检查绑定是否已存在,只在需要时添加.

实际脚本

Import-Module WebAdministration

$websites = Get-ChildItem 'IIS:\Sites'
$site = $websites | Where-object { $_.Name -eq 'Default Web Site' }
$netTcpExists = [bool]($site.bindings.Collection | ? { $_.bindingInformation -eq '808:*' -and $_.protocol -eq 'net.tcp' })

if (!$netTcpExists)
{
    Write-Output "Net TCP binding does not exist. Creating binding now..."
    # Create the binding
    New-ItemProperty 'IIS:\Sites\Default Web Site' -name bindings -Value @{protocol="net.tcp";bindingInformation="808:*"}

    Write-Output "Binding created"
}
else
{
    Write-Output "TCP Binding already exists"
}

Write-Output "Updating enabled protocols..."

Set-ItemProperty 'IIS:\sites\Default Web Site' -name EnabledProtocols -Value "http,net.tcp"

Write-Output "Enabled protocols updated"
Run Code Online (Sandbox Code Playgroud)


Ned*_*Ned 7

最后一步对我有用。

\n\n
    \n
  1. 确保这些协议在网站的 \xe2\x80\x9cAdvanced Settings\xe2\x80\x9d 中定义\n在此输入图像描述
  2. \n
  3. 确保安装了以下功能\n在此输入图像描述
  4. \n
  5. 以下服务应该正在运行\n在此输入图像描述
  6. \n
  7. 您的应用程序池应该使用集成管道
  8. \n
  9. 关闭 IIS 管理器,重置 IIS,然后再次打开 IIS 管理器
  10. \n
  11. 检查applicationHost.config 文件中的listenerAdapters 部分(位于C:\\Windows\\System32\\inetsrv\\config)。如果\xe2\x80\x99 没有看到要在绑定中使用的侦听器适配器,请手动添加它们\n在此输入图像描述\n来源:IIS 中缺少绑定(net.tcp、net.pipe、net.msmq、msmq.formatname)
  12. \n
\n