LoginSignup
0
0

More than 5 years have passed since last update.

HttpListner.Start()でアクセス拒否された話

Posted at

現象

下記のようなコードを書いたところ、HttpListenerException が発生した。

// string endPoint = "http://localhost:8080"; // こちらは例外でない
string endPoint = "http://<host>:8080"; // こっちは例外が出る
HttpListener server = new HttpListener();
server.Prefixes.Add(endPoint);
server.Start();

対策

ネットで調べたところ、管理者で実行しないとエラーになるらしい
参考) http://sweep3092.hatenablog.com/entry/2014/12/27/160005

参考元の記述に従い、マニフェストファイルでプログラムを管理者権限で実行するよう、修正した。

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0