简体   繁体   English

Visual Studio 正在运行,但本地主机无法连接

[英]visual studio is running, but localhost can't connect

I have vs 2015, and a asp.net mvc 5 website.我有 vs 2015 和一个 asp.net mvc 5 网站。 It was running fine until a while back, but just today I noticed it stopped working.直到不久前它运行良好,但就在今天,我注意到它停止工作。 When I start debugging, visual studio is running fine, and so is IIS Express, but localhost page cannot be found.当我开始调试时,visual studio 运行良好,IIS Express 也是如此,但找不到 localhost 页面。

This is what my IIS Express.这是我的IIS Express。

IIS Express

And the visual studio和视觉工作室

视觉工作室 2015

And the browser还有浏览器

本地主机

I cannot figure out what is wrong.我无法弄清楚出了什么问题。 Things I've tried, which didn't help:我尝试过但没有帮助的事情:

1) Reinstall (clean) IIS Express 10 1)重新安装(干净)IIS Express 10
2) Deleted the folder C:\\Users\\Razor\\Documents\\IISExpress so that when visual studio is restarted, it creates the folder again. 2) 删除文件夹C:\\Users\\Razor\\Documents\\IISExpress以便在重新启动 Visual Studio 时,它会再次创建该文件夹。
3) Deleted the Solution folder's .vs directory (that contains the applicationhost.config) and it was re-created again. 3) 删除解决方案文件夹的.vs目录(包含 applicationhost.config)并再次重新创建。

None of the above methods have worked.以上方法都没有奏效。 Can anyone help me figure out what's going wrong in here?谁能帮我弄清楚这里出了什么问题?

Close IIS EXPRESS and try again关闭IIS EXPRESS 并重

EDIT : I know that this sound a little bit crazy but try to disable Firewall and re-enable it.编辑:我知道这听起来有点疯狂,但尝试禁用防火墙并重新启用它。 This is working for me.这对我有用。

I am also facing same problem , after lots of efforts like deleting IIS profile , adding firewall rules and opening vs in administrator mode and many other....我也面临着同样的问题,经过大量的努力,比如删除 IIS 配置文件,添加防火墙规则和在管理员模式下打开 vs 以及许多其他......
i found solution.我找到了解决方案。
1) Stop all those application who uses IIS 1) 停止所有使用 IIS 的应用程序
2) Edit file %userprofile%\\Documents\\IISExpress\\ApplicationHost.config. 2) 编辑文件 %userprofile%\\Documents\\IISExpress\\ApplicationHost.config。
3) find your solution name inside of all registred sites 3) 在所有注册站点中找到您的解决方案名称

<system.applicationHost> 
<sites>
    <site name="YourSolutionName" id="2">
        <application path="/" applicationPool="YourApplicationPoolName">
            <virtualDirectory path="/" physicalPath="YourSolutionPath" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:1234:localhost" />
        </bindings>
    </site>
</sites>
</system.applicationHost>

Confirm Port number in bindingInformation.在 bindingInformation 中确认端口号。
4) Now go to your visual studio. 4) 现在去你的视觉工作室。
5) Right click on solution -> Go to properties -> Inside Web tab set Project URL : http://localhost:1234/ also check Override application root URL check box. 5) 右键单击​​解决方案 -> 转到属性 -> 内部 Web 选项卡集项目 URL: http://localhost:1234/还选中覆盖应用程序根 URL 复选框。 Set this URL also http://localhost:1234/也设置这个 URL http://localhost:1234/
6)Save this and run application. 6)保存并运行应用程序。
Note : While changing ApplicationHost.config file you found multiple instances of your code.注意:在更改 ApplicationHost.config 文件时,您发现了代码的多个实例。 you have to find latest port and update it with your port number.你必须找到最新的端口并用你的端口号更新它。

对我有用的是从控制面板修复 IIS Express 10(或您获得的版本)

Please follow the below step:请按照以下步骤操作:

  1. Remove the directory %userprofile%\\Documents\\IISExpress.删除目录 %userprofile%\\Documents\\IISExpress。

  2. Delete the applicationhost.config file which is placed within the .vs\\Config\\ folder in your Visual Studio project root folder.删除位于 Visual Studio 项目根文件夹的 .vs\\Config\\ 文件夹中的 applicationhost.config 文件。

  3. Restart the Visual Studio with run as Administrator.以管理员身份运行重新启动 Visual Studio。

  4. Run the your project.运行你的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM