在我位于管理员组的 Windows 8.1 计算机上托管 WCF Net.Tcp 服务时,出现以下错误:
服务端点无法侦听 URI“net.tcp://localhost:9001/dataservice”,因为访问被拒绝。验证当前用户是否已在 SMSvcHost.exe.config 的相应allowAccounts 部分中获得访问权限。
我什至按照建议将用户添加到配置中:
<?xml version="1.0" encoding="utf-8"?>
<!-- The configuration file for SMSvcHost.exe -->
<configuration>
<runtime>
<gcConcurrent enabled="false" />
</runtime>
<system.serviceModel>
<!-- SMSvcHost ETW traces are redirected by default to an etwProviderId different from WCF's default.
To trace to the default provider, remove the etwProviderId attribute below. -->
<diagnostics performanceCounters="Off" etwProviderId="{f18839f5-27ff-4e66-bd2d-639b768cf18b}"/>
</system.serviceModel>
<system.serviceModel.activation>
<net.tcp listenBacklog="10" maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10" teredoEnabled="false">
<allowAccounts>
<add securityIdentifier="S-1-5-18"/>
<add securityIdentifier="S-1-5-19"/>
<add securityIdentifier="S-1-5-20"/>
<add securityIdentifier="S-1-5-32-544" />
<add securityIdentifier="S-1-5-21-2476327175-1934278006-4092406606"/>
</allowAccounts>
</net.tcp>
<net.pipe maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10">
<allowAccounts>
<add securityIdentifier="S-1-5-18"/>
<add securityIdentifier="S-1-5-19"/>
<add securityIdentifier="S-1-5-20"/>
<add securityIdentifier="S-1-5-32-544" />
<add securityIdentifier="S-1-5-21-2476327175-1934278006-4092406606"/>
</allowAccounts>
</net.pipe>
<diagnostics performanceCountersEnabled="true" />
</system.serviceModel.activation>
</configuration>
但仍然得到同样的错误,这工作正常,不需要在 W7 机器上更改配置,有什么想法吗?
一步步:
- 下载工具PSGETSID程序 from Windows Sysinternals Live https://live.sysinternals.com/。这是 Microsoft 的实时存储库系统内部 tools.
- 执行命令:psgetsid.exe [您的用户名]
- 这将列出SID作为您的用户名。记下来。
- 打开视窗服务.
- 右键单击Net.Tcp端口共享服务并选择特性在菜单上。
- In the 常规选项卡, 找出可执行文件的路径。打开Windows资源管理器并转到该文件夹。这是运行服务的文件夹。
- 查找并打开文件SMSvcHost.exe.config.
-
添加以下值:
<system.serviceModel.activation>
<net.tcp listenBacklog="16" maxPendingAccepts="4" maxPendingConnections="100" receiveTimeout="00:00:30" teredoEnabled="false">
<allowAccounts>
<!-- LocalSystem account -->
<add securityIdentifier="S-1-5-18"/>
<!-- LocalService account -->
<add securityIdentifier="S-1-5-19"/>
<!-- Administrators account -->
<add securityIdentifier="S-1-5-20"/>
<!-- Network Service account -->
<add securityIdentifier="S-1-5-32-544" />
<!-- IIS_IUSRS account (Vista only) -->
<add securityIdentifier="S-1-5-32-568"/>
<!-- Your user account SID -->
<add securityIdentifier="Your SID Here" />
</allowAccounts>
</net.tcp>
<diagnostics performanceCountersEnabled="true" />
</system.serviceModel.activation>
保存对文件的更改SMSvcHost.exe.config.
- 重新启动Net.Tcp端口共享服务.
Done!
希望能帮助到你。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)