Questions tagged «httplistener»

10
HttpListener访问被拒绝
我正在用C#编写HTTP服务器。 当我尝试执行功能时,HttpListener.Start()我会HttpListenerException说一句 “拒绝访问”。 当我在Windows 7中以管理模式运行该应用程序时,它可以正常工作。 我可以在没有管理员模式的情况下运行它吗?如果是,怎么办?如果没有,在开始运行后如何将应用程序更改为管理模式? using System; using System.Net; namespace ConsoleApplication1 { class Program { private HttpListener httpListener = null; static void Main(string[] args) { Program p = new Program(); p.Server(); } public void Server() { this.httpListener = new HttpListener(); if (httpListener.IsListening) throw new InvalidOperationException("Server is currently running."); httpListener.Prefixes.Clear(); …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.