带有 net.tcp 的 WCF 错误“服务端点未能侦听 URI,因为访问被拒绝

编程入门 行业动态 更新时间:2024-10-23 02:09:10
本文介绍了带有 net.tcp 的 WCF 错误“服务端点未能侦听 URI,因为访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在我属于管理员组的 Windows 8.1 机器上托管 WCF Net.Tcp 服务时,我收到以下错误:服务端点未能侦听 URInet.tcp://localhost:9001/dataservice",因为访问被拒绝.在 SMSvcHost.exe.config 的相应 allowAccounts 部分验证当前用户是否被授予访问权限.

I'm getting the following error when hosting WCF Net.Tcp service on windows 8.1 machine where I'm in the administrators group: The service endpoint failed to listen on the URI 'net.tcp://localhost:9001/dataservice' because access was denied. Verify that the current user is granted access in the appropriate allowAccounts section of SMSvcHost.exe.config.

我什至按照建议将用户添加到配置中:

I even added the user to the config as suggested:

<?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 机器上无需更改配置即可正常工作,有什么想法吗?

But still get the same error, this works fine without any need for config change on a W7 machine, any ideas?

推荐答案

我以为我在配置中添加了正确的 sid,但实际上我使用了错误的 sid.为了获得 sid,我使用了 cmd psgetsid 假设这会给我当前登录的用户,即我自己但不是,然后我使用 cmd psgetid [username] 这给了我一个不同的 sid.使用了这个,现在它可以工作了.

I thought I had added the correct sid in the config but in fact I used the wrong sid. To get hold of the sid I used the cmd psgetsid assuming this would give me the current logged in user which is myself but no, I then used cmd psgetid [username] and this gave me a different sid. Used this and now it works.

这篇关于带有 net.tcp 的 WCF 错误“服务端点未能侦听 URI,因为访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 19:37:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1141152.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:被拒   错误   tcp   net   URI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!