我正在尝试使用netTcpBinding在WindowsService中托管WCF服务,因为我想在没有localhost管理员权限的情况下托管它。 托管它的一切都很好。它成功托管。但是当我使用Service对象在我的客户端应用程序中使用它时,我收到错误" PlatformNotSupportedException - 不支持DnsEndpointIdentity
这就是我的配置的样子:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyLibrary.MyServiceBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyLibrary.MyServiceBehavior"
name="MyLibrary.MyService">
<endpoint address="" binding="netTcpBinding"
contract="MyLibrary.IMyService" bindingConfiguration="">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding"
contract="IMetadataExchange" bindingConfiguration=""/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost/MyService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>