我有一个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?


当前回答

@roblll说对了。但对于那些不想挖掘答案的人来说,这就是:

Close Visual Studio (might not be necessary, but it won't hurt). Navigate to your Documents folder. This is where my IISExpress configuration directory was. In the config folder, there is a file called the application host. Open that. Search for the name of your project. It should have been added in there by Visual Studio when it bombed in your previous attempts. Note that there's a binding for HTTP with the port you intend to use for https. //Change this: <binding protocol="http" bindingInformation="*:44300:localhost" /> //to this: <binding protocol="https" bindingInformation="*:44300:localhost" />

请记住,Visual Studio可能提供了与您期望的不同的端口。只需确保绑定中的端口对应于项目属性的Web选项卡中的端口。

http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

其他回答

分享给未来的读者。手动创建一个虚拟目录对我来说很有用。

在解决方案资源管理器中选择项目 按Alt + Enter 转到网页部分 单击“创建虚拟目录”

我今天碰到了这个错误。运行win8.1和vs2013。突然我的项目不能再运行了,我收到了“无法启动IIS快速Web服务器”的消息,没有进一步的信息。

过了一段时间,我发现IIS Express无法启动的所有项目都在运行。net 3.5。运行新版本的项目确实开始得很好。

我的解决方案是删除。net 3.5(从控制面板->打开/关闭窗口功能),重新启动窗口,然后再次添加。net 3.5。

如果使用VS2015或以上版本

确保iisexpress进程没有运行。

确保没有其他进程正在使用所需的端口。你可以通过执行来实现

Netstat -a -b

在控制台中(作为管理员,在开始菜单中键入cmd,右键单击并选择“以管理员身份运行”)。如果您看到状态为ESTABLISHED或LISTENING的条目,则意味着有其他进程正在使用该端口。您需要终止该进程或更改端口。

然后删除以下文件

<<path_to_solution_folder>>\.vs\config\applicationhost.config

注意。vs文件夹可能被隐藏

然后找到<<project-name>>.csproj。用户文件,用文本编辑器(记事本)打开 并确保WebProjectProperties下的IISUrl配置为<IISUrl>http://localhost:XXXXX/</IISUrl>,其中XXXXX是您想要的端口。

在这样做并尝试启动应用程序后,你可能会得到

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

然后转到{项目属性}-> Web,按下“创建虚拟目录”按钮

请查看快照,我遇到了同样的错误,但下面的设置解决了它

选择“当前页”为“开始操作” 在Servers选项中选择特定的端口并输入端口26641,在虚拟路径中输入/ NTLM选项应未选中

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

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 .运行项目

这对我很管用。