在 IIS7 中启用 net.tcp

发布于 2024-09-08 06:04:38 字数 46 浏览 4 评论 0原文

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

How can I make IIS handle net.tcp connections?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

勿忘初心 2024-09-15 06:04:38

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

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

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

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

You need to add net.tcp to the enabled protocols of your site. Go to IIS Manager, right-click on your website, go to 'Manage Web Site' or 'Manage Application', then to 'Advanced Settings...'. There you see 'Enabled Protocols'. It probably says http. Change it to http,net.tcp.

If you want to configure bindings, right-click on your website and go to 'Edit Bindings...'. The default net.tcp binding is 808:*.

If you want to use WCF services hosted by IIS behind net.tcp, you may also want to check whether you have activated the required Windows Features. Go to your Windows Features and check you have activated 'Windows Communication Foundation Non-HTTP Activation' (found under 'Microsoft .NET Framework 3.5.1').

When you activate this feature, you will get some extra Windows Services. If it still doesn't work, check that the Windows Service named 'Net.Tcp Listener Adapter' is running (it should start automatically but sometimes it doesn't and this is the first place I check when one of my net.tcp services stops working).

゛清羽墨安 2024-09-15 06:04:38

这可能会对将来的某人有所帮助。我创建了一个 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"

This might help someone in the future. I created a powershell script that will come in useful if you need to automate the creation of the bindings.

It will automatically check if the binding exists already and only add it when required.

Actual Script

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"
长途伴 2024-09-15 06:04:38

最后一步对我有用。

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

The last step worked for me.

  1. Make sure that these protocols are defined in the “Advanced Settings” of the website
    enter image description here
  2. Make sure the features below are installed
    enter image description here
  3. The services below should be running
    enter image description here
  4. Your application pool should use Integrated pipeline
  5. Close IIS Manager, reset IIS, and open IIS Manager again
  6. Check the listenerAdapters section in the applicationHost.config file ( Located in C:\Windows\System32\inetsrv\config). If you don’t see those listener adapters you want to use in bindings, add them manually
    enter image description here
    Source: Missing bindings in IIS (net.tcp, net.pipe, net.msmq, msmq.formatname)
雨巷深深 2024-09-15 06:04:38

就我而言,我不仅必须将 net.tcp 协议添加到网站,还要添加到其下面的应用程序(右键单击应用程序、高级设置、启用协议)。

In my case, I had to add the net.tcp protocol not only to the website, but to the application below it (right-click the application, advanced settings, enabled protocols).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文