wcf webservice not running



我正在尝试创建一个wcf服务

但在运行时,它一直在用以下错误困扰我

HTTP无法注册URL HTTP://+:80/ConsoleWCFapp/。您的进程没有对此命名空间的访问权限(请参阅http://go.microsoft.com/fwlink/?LinkId=70353详细信息)。

代码

static void Main(string[] args)
{
   ServiceHost host = new ServiceHost(typeof(StockService), new Uri("http://localhost:8000/ConsoleWCFapp"));
   host.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding(), "");
   host.Open();
   Console.WriteLine("Listening to request now, Please enter to exit nn");
   Console.ReadLine();
   host.Close();
}

请通知

以管理员身份运行代码/View Studio。我只是在我的环境中遇到了同样的事情。

 static void Main(string[] args)
    {
        ServiceHost host = new ServiceHost(typeof(StockService));
        host.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding(), "http://localhost:8000/ConsoleWCFapp");
        host.Open();
        Console.WriteLine("Listening to request now, Please enter to exit nn");
        Console.ReadLine();
        host.Close();
        }

试试

最新更新