我有一个ASP。NET MVC 4解决方案。当我尝试使用Visual Studio 2012打开它时,我得到以下错误:

Microsoft Visual Studio 为ASP配置Web https://localhost:。NET 4.5失败。你必须 手动配置此站点的ASP。NET 4.5才能使站点 正确地运行。无法在https://localhost:44300/上找到服务器 本地机器。确保已配置本地IIS服务器 支持安全通信。

尽管解打开了。此外,当我试图从调试菜单运行它时,我得到以下错误:

无法启动IIS Express Web服务器。 指定的起始URL无效。https://localhost:44300/

我无法调试代码。如何摆脱这些错误和调试/运行网站从VS 2012?


当前回答

在解决方案资源管理器中右键单击项目

tab Web,按“创建虚拟目录”

其他回答

对我来说唯一有效的解决方案是创建另一个测试项目。然后按照下面的步骤:

Right click the project and go to Properties -> Web Under the project URL in the Use Local IIS Web Server section, copy the project URL(http:// localhost:59002/) - this is from the test project. Navigate to the project which is giving this error. Right click the project and go to Properties -> Web. Paste the project URL in the Use Local IIS Web Server section (URL copied from the test project). Close the test project and save. Delete the test project and run the project that gave the error. Works after that...

也许不是最好的方法,但这是我能让它工作的唯一方法。我收到这个错误消息后,我重新加载我的笔记本电脑(硬盘崩溃),并从他们所在的服务器上获得了我所有的项目。

我的问题需要三方面的解决方案:

删除Documents文件夹中的IISExpress文件夹。 通过右键单击并选择“设置为启动项目”,或者通过解决方案属性将web项目设置为启动项目。 设置启动URL,或设置为“当前页面”或“特定页面”。我的设置是“不要打开任何一页”。等待来自外部应用程序的请求”,我不得不将其更改为“特定页面”,我将其留空,这样它就会进入我的应用程序的主页,然后才能正常工作。

我也有同样的问题。请遵循以下步骤:

1-在Documents\IISExpress\config中打开applicationhost文件,如果不存在,则添加以下代码

            <site name="solutionname" id="2">
                <application path="/" applicationPool="solutionname">
                    <virtualDirectory path="/" physicalPath="physicaladdressofproject" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:xxxx:localhost" />
                </bindings>
            </site>

2-然后转到项目的根文件,删除使用不同版本的Visual Stdio对项目进行的所有更新

3-下一步进入[root]。vsconfig,删除applicationhost 它将自动创建

4 .运行项目

这对我很管用。

我也有同样的问题。我通过改变项目属性的端口号来解决这个问题。我把端口号50624改成了50625。

我也有同样的问题。 原因是IIS配置文件不好。

尝试删除自动创建的IISExpress文件夹,该文件夹通常位于%userprofile%/Documents,例如C:\Users\[you]\Documents\IISExpress。

别担心,一旦你再次运行你的解决方案,VS应该再次创建它——这次是正确的。


EDIT:删除文件夹的命令行:

rmdir /s /q "%userprofile%\Documents\IISExpress"