简体   繁体   English

Visual Studio IIS Express 在启动时挂起,但 IIS 本地工作,为什么?

[英]Visual Studio IIS Express hangs on launch, but IIS local works, why?

I run Visual studio 2015 as administrator, start a new project, ASP.NET application, Empty 4.5.2 and then just add a simple html page.我以管理员身份运行 Visual Studio 2015,启动一个新项目,ASP.NET 应用程序,Empty 4.5.2,然后添加一个简单的 html 页面。 When I try to launch using IIS Express, I just get waiting for local host.当我尝试使用 IIS Express 启动时,我只是在等待本地主机。 If I do this under IIS local it works fine.如果我在 IIS 本地下执行此操作,则它可以正常工作。

I have this working correctly on my laptop and did a clean install of windows 10 on my desktop and then reinstalled VS2015, but still get same result.我在我的笔记本电脑上正常工作,并在我的桌面上全新安装了 Windows 10,然后重新安装了 VS2015,但仍然得到相同的结果。 IIS express starts but the web page keeps waiting for local host IIS express 启动但是网页一直在等待本地主机

I've looked at a number of solutions but have been unable to resolve the problem.我查看了许多解决方案,但一直无法解决问题。 I'm a newbie to all of this so would appreciate step by step instructions on how to resolve.我是所有这一切的新手,因此希望得到有关如何解决的分步说明。

It is a .Net Framework 4.5.2 application.它是一个 .Net Framework 4.5.2 应用程序。

Exit Visual studio and delete the (project).vs folder.退出 Visual Studio 并删除 (project).vs 文件夹。 Restart Visual studio.重新启动 Visual Studio。 It should start working.它应该开始工作。

You could try to change the port which IIS Express is using by doing the following:您可以尝试通过执行以下操作来更改 IIS Express 正在使用的端口:

  1. Right click you web project and click in properties右键单击您的 Web 项目并单击属性

  2. In the web menu, change the project url and specify a custom port, ie: 56000在 web 菜单中,更改项目 url 并指定自定义端口,即:56000

在此处输入图片说明

  1. Save your changes and see if that works!保存您的更改,看看是否有效!

You can make sure that no other processes are using the port you chose by running the following command:您可以通过运行以下命令来确保没有其他进程正在使用您选择的端口:

netstat -na | find "your port number"

ie: IE:

netstat -na | find "56000"

If the port is free, nothing will be outputted to the console.如果端口空闲,则不会向控制台输出任何内容。

Sometimes Visual Studio just takes many minutes to load all the required symbols when debugging.有时,Visual Studio 在调试时只需要几分钟来加载所有必需的符号。 Check the status bar of Visual Studio:查看 Visual Studio 的状态栏:

在此处输入图片说明

Once for some reason IIS Express worked if I changed the browser targeted in Visual Studio to Google Chrome.如果我将 Visual Studio 中的目标浏览器更改为 Google Chrome,IIS Express 曾经由于某种原因工作。 Simply restarting Visual Studio fixed this for me though.不过,只需重新启动 Visual Studio 即可为我解决此问题。

在此处输入图片说明

Solution:解决方案:
1. Run VS as Administrator. 1. 以管理员身份运行VS。 Open your sln, Start debugging, stop and close the VS.打开您的 sln,开始调试,停止并关闭 VS。
2. Again open the sln (without admin) file and start debugging. 2. 再次打开 sln(不带管理员)文件并开始调试。
It worked!有效!

Problem:问题:
- My VS2017 was running fine with debugging, until some other tool's installation corrupted it. - 我的 VS2017 在调试时运行良好,直到其他一些工具的安装损坏了它。 Then I reinstalled it.然后我重新安装了它。 When I started debugging/running site, it wasn't even opening first page of site.当我开始调试/运行站点时,它甚至没有打开站点的第一页。 It was keep loading assemblies forever.它一直在加载程序集。 I tried many things found on google.我尝试了很多在谷歌上找到的东西。 It didn't help.它没有帮助。
- Finally I tried opening it with Admin and then regular. - 最后我尝试用管理员打开它,然后定期打开它。 It solved my problem.它解决了我的问题。

  1. Right click on your web Project and click properties右键单击您的 Web 项目并单击属性
  2. Go to web tab on the right转到右侧的 web 选项卡
  3. In the server section, change local IIS to IIS Express在服务器部分,将local IIS更改为IIS Express

Hope this helps希望这可以帮助

Just right click on HtmlPage1.html in solution explorer and click Set As Start Page .只需右键单击解决方案资源管理器中的HtmlPage1.html并单击Set As Start Page After that run project again.之后再次运行项目。

在此处输入图片说明

I had same problem and all advices not working.我遇到了同样的问题,所有建议都不起作用。 But I run visual studio as administrator and all working now.但我以管理员身份运行visual studio,现在一切正常。 So, go to shortcut of visual studio, properties, advance..., and check run as administrator.因此,转到visual studio,属性,高级...的快捷方式,并检查以管理员身份运行。

Look into applicationhost.config file under查看下的applicationhost.config文件

YOUR_DOCUMENTS_PATH\\IISExpress\\config\\ YOUR_DOCUMENTS_PATH\\IISExpress\\config\\

Localize defaultDocument setting and add your static html page full name (yourpage.html) or use one of the options available if you want to stick to the standards:本地化defaultDocument设置并添加您的静态 html 页面全名 (yourpage.html),或者如果您想遵守标准,请使用可用选项之一:

   <defaultDocument enabled="true">
        <files>
            <add value="Default.htm" />
            <add value="Default.asp" />
            <add value="index.htm" />
            <add value="index.html" />
            <add value="iisstart.htm" />
            <add value="default.aspx" />
        </files>
    </defaultDocument>

I think IIS is disabled in your system.我认为您的系统中禁用了 IIS。 Please follow the below steps:请按照以下步骤操作:

  1. Go to Control Panel进入控制面板
  2. Open Program and Features开放程序和功能
  3. On the left side, you will find 'Turn Windows features On or Off', click on it.在左侧,您会找到“打开或关闭 Windows 功能”,单击它。
  4. Check that IIS is checked with all the subfeatures.检查 IIS 是否已检查所有子功能。 I am attaching a screenshot below for your reference.我在下面附上截图供您参考。

在此处输入图片说明

  1. Make sure all the checkboxes should be ticked.确保应勾选所有复选框。
  2. Now restart your system.现在重新启动系统。

I think this will solve your issue.我认为这将解决您的问题。

对我来说,解决方案是下载:https ://docs.microsoft.com/en-us/sysinternals/downloads/tcpview找到本地端口(连接到 Microsoft 服务器 - 奇怪!)和“结束进程。 ..”在 TcpView 中。

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

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