C# 不以本地管理员身份运行WCF服务TCP
我正在尝试启动WCF服务,在没有管理员权限的情况下侦听net.tcp(出于客户端安全原因) 我尝试了不同的端口,8085000,但都不起作用 .NET错误为:C# 不以本地管理员身份运行WCF服务TCP,c#,.net,windows,wcf,net-tcp,C#,.net,Windows,Wcf,Net Tcp,我正在尝试启动WCF服务,在没有管理员权限的情况下侦听net.tcp(出于客户端安全原因) 我尝试了不同的端口,8085000,但都不起作用 .NET错误为: System.ServiceModel.CommunicationException: The service endpoint failed to listen on the URI 'net.tcp://localhost:5000/ServiceName.svc' because access was denied. Verify
System.ServiceModel.CommunicationException: The service endpoint failed to listen on the URI 'net.tcp://localhost:5000/ServiceName.svc' because access was denied. Verify that the current user is granted access in the appropriate allowAccounts section of SMSvcHost.exe.config. ---> System.ComponentModel.Win32Exception: Access is denied
at System.ServiceModel.Activation.SharedMemory.Read(String name, String& content)
at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.ReadEndpoint(String sharedMemoryName, String& listenerEndpoint)
内部异常:
"Access Denied"
at System.ServiceModel.Activation.SharedMemory.Read(String name, String& content)
at System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.ReadEndpoint(String sharedMemoryName, String& listenerEndpoint)
我试图编辑我的SMSvcHost.exe.config。我使用了Windows10服务中网络“tcp端口共享”使用的那个,使用了正确的SID并重新启动了服务
现在,我的配置文件如下所示:
<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>
<!-- Below are some sample config settings: -->
<system.serviceModel.activation>
<net.tcp listenBacklog="100" maxPendingConnections="200" maxPendingAccepts="200" receiveTimeout="00:00:10" 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"/>
<add securityIdentifier="S-1-5-21-1123561945-1343024091-682003330-4833"/>
</allowAccounts>
</net.tcp>
<diagnostics performanceCountersEnabled="true" />
</system.serviceModel.activation>
谢谢您是否尝试使用默认的IIS类型用户或本地/Ad帐户是的,我尝试使用域用户,使用该帐户如果他是我计算机的本地管理员据我所知,Http协议地址受netsh命令保护,我们需要授权访问。对于nettcp协议地址,防火墙通常接管安全角色。所以我认为你应该考虑防火墙。NOP,不工作…它目前正在使用net.pipe绑定,但不是net.Tcp,我需要net.Tcp…您是否尝试使用默认的IIS类型用户或本地/Ad帐户是的,我正在尝试使用域用户,如果他是我计算机的本地管理员,则使用该帐户据我所知,Http协议地址受netsh命令保护,我们需要授权访问。对于nettcp协议地址,防火墙通常接管安全角色。所以我认为你应该考虑防火墙。NOP,不工作…它目前正在使用net.pipe绑定,但不是net.Tcp,我需要net.Tcp。。。