第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

HttpListener訪問被拒絕

HttpListener訪問被拒絕

慕運(yùn)維8079593 2019-08-24 15:02:27
HttpListener訪問被拒絕我在C#中編寫HTTP服務(wù)器。當(dāng)我嘗試執(zhí)行該功能時(shí),HttpListener.Start()我得到一個(gè)HttpListenerException說(shuō)法“拒絕訪問”。當(dāng)我在Windows 7中以管理員模式運(yùn)行應(yīng)用程序時(shí),它工作正常。我可以在沒有管理員模式的情況下運(yùn)行嗎 如果有,怎么樣?如果不是,如何在開始運(yùn)行后讓應(yīng)用程序更改為管理模式?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();             httpListener.Prefixes.Add("http://*:4444/");             try             {                 httpListener.Start(); //Throws Exception             }             catch (HttpListenerException ex)             {                 if (ex.Message.Contains("Access is denied"))                 {                     return;                 }                 else                 {                     throw;                 }             }         }     }}
查看完整描述

3 回答

?
偶然的你

TA貢獻(xiàn)1841條經(jīng)驗(yàn) 獲得超3個(gè)贊

您可以通過(guò)設(shè)置IgnoreWriteExceptions來(lái)修復(fù)沒有管理員權(quán)限的localhost:

listener.IgnoreWriteExceptions = True
listener.Start()


查看完整回答
反對(duì) 回復(fù) 2019-08-24
  • 3 回答
  • 0 關(guān)注
  • 1588 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)