Unable to connect to web server 'IIS Express'(无法连接到Web服务器“IIS Express”)的解决方式-Jexus Manager
在运行微软示例工程eShopOnWeb时候, 在经过一段时间再运行启动报Error "Unable to connect to web server 'IIS Express'" (无法连接到Web服务器“IIS Express”). 网上搜索了一下发现
在依乐祝的博客中发现提到更改“属性-调试-启动”为IIS的替代方式解决无法运行问题, 但对于本人而言,仍然报错. 于是bing了一番. 发现有一国外博文使用Jexus Manager来解决该问题. 本人问题在安装该软件运行一次后解决.(惊!...)
不过该软件国内不太好下载. 于是在这里分享一下.
链接:
https://pan.baidu.com/s/1D_PNZpDDz3NMZObp6Cxe0A
提取码:
ygcc
[参考]
VS2017 无法连接到Web服务器“IIS Express”终极解决方案
https://www.cnblogs.com/yilezhu/p/10571618.html
[转自]
Peculiar case of "Unable to connect to web server 'IIS Express'"
https://codecultivation.com/peculiar-case-of-unable-connect-to-web-server-iis-express/
There was one particular ASP.NET Core project that I have left it for quite a long time. Therefore, I would need to refresh my memory in order to understand how it works by first running it in debugging mode in Visual Studio 2017. To my suprise, as soon as I pressed F5, there was a popup error as below:

Of course, like everyone else, I would first check my launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:51841",
"sslPort": 44353
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication5": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
It just looked fine for me. So, what could go wrong?
Method 1 (Remove .vs folder)
After searching in Google, quite a number of people suggesting to remove .vs folder from the project and let Visual Studio to auto generate the .vs folder (especially the applicationhost.config in config folder and it should work after that. It didn't work for me.

In case you ask where to find .vs folder, simply make sure to show hidden folder or files in Folder Options menu.

Method 2 (Run as administrator)
The second way that should work is to run Visual Studio as administrator. Simply right-click on Visual Studio shortcut and choose Run as administrator

However, I was not happy with both methods above. I think there must be some other hidden reason behind this.
Method 3 (Diagnostic approach)
First, I need to find out what if I can have some sort of log file or error message. Unable to connect to web server 'IIS Express' doesn't help. Visual Studio in this case didn't really help me much to give more information about this issue.
After doing some digging around on Internet, I came across a management console built for IIS Express called Jexus Manager that apparently provides some good diagnostic reports about your website.

To begin, choose the option Connect to a Server like below.

In Choose Server Type screen, make sure to choose Visual Studio IIS Express Configuration File like below.

And then, choose the targeted Visual Studio solution file (.sln) like below.

Make sure option From Visual Studio .vs folder is selected.

Simply click Finish button to complete the process.

Finally, I would see a new connection was created in Connections pane.

Normally, we could ignore the first WebSite1 as it is just a default website. Select the next website and I would see some options in Actions pane.

At first, all those Diagnostics reports didn't really help me much here. However, when I chose to Start the website (under Manage Website section), something interesting popped up.

Now, this was something interesting for me. I had to admit that I did not understand all those special numbers and process names, but fortunately the final two lines helped me to go further. Apparently, I could execute iisexpress.exe in Command Prompt to investigate further! At this point of time, I was happy and nervous at the same time as it proved my lack of knowledge on IIS Express but was happy to learn something new too.
Let's open Command Prompy and navigate to C:\Program Files\IIS Express. To start IIS Express, simply execute the command line below.
iisexpress.exe /config:"c:\[your project path]\.vs\config\applicationhost.config" /site:WebApplication5 /trace:error
The output in Command Prompt was as below.

Noticed that IIS Express complained it was failed to register URL "http://localhost:51841/" as access was denied. Subsequently, it was failed to register "https://localhost:44353/" as it cannot create a file when that file already exists. I knew that the first error message was a clue but I just couldn't understand why.
Also, I noticed that there was a notification popup from IIS Express too.

When clicked, I could see IIS Express Notifications screen.

The message in notification further clarified that I needed administrative privileges to bind to hostname or port and article Handling URL binding failures in IIS Express helped me alot in understanding how IIS Express handling URL binding. In this article, it clearly states that you need administrative privileges to configure HTTP.sys (an OS component that handles HTTP and SSL traffic for both IIS and IIS Express) for the following scenarios,
- Using reserved ports such as 80 or 443
- Serving external traffic
- Using SSL
To configure HTTP.sys, I needed to use netsh.exe utility. After going thru the article, I noticed that it has alot to do with urlacl switch. urlacl stands for URL Access Control List which creates reservation for particular group of users. You can read more about it here.
At this point, I was interested to find out the list of reservation entries in my computer by running netsh http show urlacl and I saw something like this below.

To my surprise, I managed to find one entry with Reserved URL: http://*.51841/
How on earth could that happen!? I presume only administrator could do that and I don't think Visual Studio will be able to add the entry by itself. After some intense investigations, I laughed at myself as the culprit was me myself all this time. Why? It was a leftover from my previous article How to access your localhost website from external LAN? I should have done the cleanup after the article. I created a problem from my own solution!
At the end, I simply removed the entry from the reservation list and IIS Express started to work fine again. The command line is as below.
netsh http delete urlacl url=http://*:51841/
Conclusion
In the end, I was having alot fun while investigating the problem and I was glad to manage to solve the issue by diagnostic approach. First, quick (temporary) solution is not a good solution, I should always aim for permanent solution. Next, it is always important to keep learning while solving problems as it would further improve my understanding. Last but not least, cleanup process is super important if you don't want to have any (not so pleasant) surprises and it's always a best practise to restore to original state after you have done the work.
Unable to connect to web server 'IIS Express'(无法连接到Web服务器“IIS Express”)的解决方式-Jexus Manager的更多相关文章
- Unable to connect to zookeeper server within timeout: 5000
错误 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error crea ...
- Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brandControl ...
- 解决loadrunner录制时 Request Connection: Remote Server @ 0.0.0.0:80 (Service=?) NOT PROXIED! (REASON: Unable to connect to remote server: rc = -1 , le = 0)问题
环境为win7+ie8+loadrunner11,录制脚本回放查看Recoding log 出现如下错误:[Net An. Error ( 7f8:1340)] Request Connecti ...
- org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeo ...
- CentOS7图形界面启动报错unable to connect to X server
以前还可以正常启动图形界面,这次启动失败,报错unable to connect to X server 使用的是oracle用户,因为我是在oracle用户下创建的oracle数据库等 解决办法: ...
- Message Unable to connect to SQL Server '(local)'
最近在sql server 加了一些job,但是run job的时候发生了一下错误: ssage Unable to connect to SQL Server '(local)' 问题根源:调用 T ...
- Unable to connect to the server: x509: certificate signed by unknown authority
0x00 Problem 在使用二进制搭建 k8s 集群的过程中,使用 kubectl get 等操作时始终显示 x509: certificate signed by unknown authori ...
- SSMS 远程连接SERVER 设置 - Unable to connect to SQL Server instance remotely
问题描述: 新装了一台SERVER,在SERVER本地打开SSMS链接sever,一且正常.但是用我自己local去链接的时候出现以下错误. A network-related or instance ...
- 在启动dubbo框架时报错。Unable to connect to zookeeper server within timeout: 5000
这是因为zookeeper服务没有启动,所以会报错超时.只要启动zookeeper就行了. zookerper的启动很简单的,网上随便搜搜都有.
随机推荐
- PHP面试题2019年奇虎360面试题及答案解析
一.单选题(共29题,每题5分) 1.以下代码 a.php 输出的结果是? a.php 的代码如下: b.php的代码如下: A.foo in a B.什么也不输出 C.报错 D.foo in b 参 ...
- 对data标签获取到的时间进行比较
前言 data(时间属性)是HTML5中新增的一个属性,常用于选择日期.时间,但这个是无法通过属性去限制其不能选择过去的时间的,这个时候就需要我们在JQ中对其进行比较了! 由于放效果图,需要在数据库里 ...
- Java 静态工厂模式的使用
多相关文章请参考:http://www.enjoytoday.cn/categorys/java 静态工厂模式给人的第一印象就是:static+abstract.这两个词汇已经说明了一切,一个是周期长 ...
- [b0042] python 归纳 (二七)_gui_tkinter_基本使用
# -*- coding: utf-8 -*- """ 学习 Tkinter画图基本控件使用 逻辑: 放几个 输入控件.点击按钮,将输入控件内容打印出来 使用: 1. 创 ...
- 测试文档(final)
1 引言 1.1编写目的 编写本测试计划的目的是: (1) 为整个测试阶段的管理工作和技术工作提供指南同时确定测试的内容和范围,为评价系统提供依据: (2) 此外还帮助安排测试活动,说 ...
- HiGV ui代码流程
在海思PDT_Init下有一个这样的函数HI_PDT_UI_Init(): 1. HI_PDT_UI_Init()函数: /*public, it should be called by main() ...
- [Go] gocron源码阅读-flag包实现命令行参数获取
调用flag包可以方便的获取到命令行中传递的参数,比如可以实现类似nginx执行程序获取命令行参数执行不同操作的目标 package main import ( "flag" &q ...
- spark-shell 中rdd常用方法
centos 7.2 spark 2.3.3 scala 2.11.11 java 1.8.0_202-ea spark-shell中为scala语法格式 1.distinct ...
- 【bzoj2648】SJY摆棋子(kdtree)
传送门 题意: 二维平面上有若干个点. 现在要维护一种数据结构,支持插入一个点以及询问其余点到某个点的最小曼哈顿距离. 思路: 这是个\(kdtree\)模板题. \(kdtree\)是一种可以高效处 ...
- Java实现记事本|IO流/GUI
Java实现记事本 题目 利用GUI实现一个简单的记事本(notepad),即打开文件,文字内容显示在界面上: 允许对文字内容进行编辑,并可以保存到文件. 代码 package notePadExp; ...