尝试连接到运行IISExpress的本地主机时,如何解决ERR_CONNECTION_REFUSED-错误502(无法从Visual Studio调试)? [英] How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?

查看:345
本文介绍了尝试连接到运行IISExpress的本地主机时,如何解决ERR_CONNECTION_REFUSED-错误502(无法从Visual Studio调试)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在Windows Server 2008上运行的,几个月前就可以使用.我现在才再次使用该服务器来进行VS的一些开发工作.

这是一个实时网络服务器,也用于提供一些测试站点.

这是在运行Visual Studio,然后启动我的项目进行调试时出现的.

在启动IISExpress时尝试通过localhost:xxxx启动任何站点(使用配置中的实际端口号访问不同的站点):

This webpage is not available

ERR_CONNECTION_REFUSED

我已经参加了几天,因为我读过其他人也遇到过类似的问题,请尝试此处中找到所有建议).

在我的hosts文件中只有两个条目指向内部服务器IP地址.没有与localhost相关的IP或引用.

我已经尽力重新安装IIS Express和Visual Studio2013.我还创建了一个全新的WebApplication网站来尝试解决此问题(简单且没有其他复杂的绑定).

启动Fiddler时,在页面上看到以下内容:

[Fiddler] The socket connection to localhost failed. 
ErrorCode: 10061. 
No connection could be made because the target machine actively refused it 127.0.0.1:23162

我已从IE的LAN连接部分中删除了所有代理设置,在此之前,我在VS中出现 red-x 弹出窗口,指示诸如 IISExpress无法启动之类的东西. /p>

这与SSL与非SSL无关.

我已经安装了TFS服务器-如果有一些奇怪的绑定干扰了,请卸载它.

我尝试多次删除IISExpress config/settings文件夹.

当前 applicationhost.config 包含:

<site name="WebApplication1" id="4">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\TFS-WorkRepository\Sandbox\WebApplication1\WebApplication1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:23162:localhost" />
                </bindings>
            </site>
            <siteDefaults>
                <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
                <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
            </siteDefaults>
            <applicationDefaults applicationPool="Clr4IntegratedAppPool" />

我希望有一个really-stuck的标签.

请提出建议,因为我不想扩展新服务器.

-更新-

在URL栏中,当我输入计算机名称或IP地址:xxxx时,我得到的是ERR_CONNECTION_TIMED_OUT而不是ERR_CONNECTION_REFUSED.

解决方案

尝试更改项目中的端口号吗?

项目属性→Web→服务器→项目网址:

不要忘记单击Create Virtual Directory,或者在更改端口号后对创建虚拟目录的提示回答是"! (感谢 Connor )

注意:我有点不愿意将其发布为答案,因为我不知道该怎么办 问题是由什么引起的,或者是什么原因引起的,但是我遇到了类似的问题,更改端口号对我来说是成功的窍门.我只是按照建议在建议中发布了此内容,该评论同样适用于其他人.

就我而言,似乎与我使用的特定端口号冲突,因此我更改为另一个端口号,然后我的站点突然弹出!我不确定这对于旧的端口号意味着什么,或者我是否能够再次使用它.也许有人比我本人更懂事.

This is running on Windows Server 2008 and used to work several months ago. I am just now using this server again for some dev work with VS.

This is live web server used to serve up a few test sites as well.

This came up when running Visual Studio, then launching my projects for debugging.

Trying to launch any site through localhost:xxxx when IISExpress has been launched (using actual port #'s in the config to access different sites):

This webpage is not available

ERR_CONNECTION_REFUSED

I have been at this for a few days already, as I have read others have had similar issues, tried most things I have read including changing the managedruntimeversion from "v4.0" to "v4.0.30319" for .net 4.5 (I have never had to do this before) and disabling the logging module (all suggestions found here).

There are only two entries in my hosts file that point to internal server IP addresses. No localhost related IP's or references.

I have gone as far as re-installing IIS Express, and Visual Studio 2013. I also created a brand new WebApplication site to try to resolve this (simple and no other complicated bindings).

When I spin up Fiddler, I see the following on the page:

[Fiddler] The socket connection to localhost failed. 
ErrorCode: 10061. 
No connection could be made because the target machine actively refused it 127.0.0.1:23162

I have removed all proxy settings from IE's LAN connection section, where before I was getting a red-x popup in VS indicating something like IISExpress could not launch.

This is not a matter of SSL vs non SSL.

I had TFS Server installed - uninstalled that in case there were some odd bindings that were interfering.

I tried deleting the IISExpress config/settings folder several times.

Current applicationhost.config contains:

<site name="WebApplication1" id="4">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\TFS-WorkRepository\Sandbox\WebApplication1\WebApplication1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:23162:localhost" />
                </bindings>
            </site>
            <siteDefaults>
                <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
                <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
            </siteDefaults>
            <applicationDefaults applicationPool="Clr4IntegratedAppPool" />

I wish there was a tag for really-stuck.

Please suggest away, as I don't want to go as far as spinning up a new server.

-- UPDATE --

In the URL bar, when I enter the computer name or IP address :xxxx I get the ERR_CONNECTION_TIMED_OUT rather than ERR_CONNECTION_REFUSED.

解决方案

Try changing the port number in your project?

Project Properties → Web → Servers → Project Url:

Don't forget to click Create Virtual Directory, or reply "Yes" to the prompt for creating virtual directory after you change your port number! (Thanks Connor)

Note: I'm a little reluctant to post this as an answer, as I have no idea what the issue is or what caused it, but I had a similar issue, and changing the port number did the trick for me. I'm only posting this per the suggestion in the comments that this worked for someone else as well.

In my case, it seemed like something was conflicting with the specific port number I was using, so I changed to a different one, and my site popped right back up! I'm not sure what that means for the old port number, or if I'll ever be able to use it again. Maybe someone more knowledgeable than myself can chime in on this.

这篇关于尝试连接到运行IISExpress的本地主机时,如何解决ERR_CONNECTION_REFUSED-错误502(无法从Visual Studio调试)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆