当我在我的配置文件中添加 portSharingEnabled 功能时,我得到了错误调用
The service endpoint failed to listen on the URI 'net.tcp://localhost:5555/Calculator'
because access was denied. Verify that the current user is granted access in the
appropriate allowAccounts section of SMSvcHost.exe.config.
老实说,我只是不明白为什么我会收到这个错误以及如何解决它。
这是我的配置文件详细信息
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="CalculatorServer.Calculator" behaviorConfiguration="CalculatorBehavior">
<endpoint address="net.tcp://localhost:5555/Calculator" binding="netTcpBinding" bindingConfiguration="PortSharingBinding"
contract="CalculatorInterFace.ICalculator" />
<endpoint address="net.tcp://localhost:5555/Calculator/mex"
binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="PortSharingBinding" portSharingEnabled="true">
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
这样我就尝试开始我的服务。
public class Program
{
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(Calculator)))
{
host.Open();
Console.WriteLine("Server Started");
Console.ReadLine();
host.Close();
}
}
}
请指导我该做什么以及我需要在我的配置文件中添加什么来修复此错误。谢谢