我正在尝试创建一个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 \n\n");
Console.ReadLine();
host.Close();
}敬请指教
发布于 2012-02-06 21:48:17
以管理员身份运行代码/ Visual Studio。我刚刚在我的环境中遇到了同样的事情。
发布于 2012-02-06 21:43:30
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 \n\n");
Console.ReadLine();
host.Close();
}试试看
https://stackoverflow.com/questions/9160936
复制相似问题