1

管理者権限なしで net.tcp をリッスンして WCF サービスを開始しようとしています (クライアントのセキュリティ上の理由から)。

さまざまなポート、808、5000 を試しましたが、何も機能しません。

.NET エラーは次のとおりです。

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 を編集しようとしました。Windows 10サービスのネット「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>

ありがとうございました

4

0 に答える 0