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


当前回答

我也有这个问题,在关闭防火墙后,在以管理员身份打开,在再次检查所有设置是否正确后。

我的问题是独特的,我想在本地测试SSL,但也有通过局域网可用的服务。所以我改变了应用程序的URL使用本地IP aka。我的情况是192.168.1.10。

切换回本地主机可以解决这个问题,关闭SSL也一样,所以我发现本地SSL证书只适用于本地主机。

其他回答

@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

我将提出一个解决这个问题的方法:

1.使用以下控制台命令删除\Documents\IISExpress文件夹:rmdir /s /q "%userprofile%\Documents\IISExpress"

Delete the applicationhost.config file which is placed within the .vs\Config\ folder in your Visual Studio project root folder. Change the project’s website random URL: within Visual Studio, right-click to the project node in Solution Explorer, then select Properties; navigate through the Web panel, then change the number in the Project Url textbox value. Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1 as shown in the following screenshot (thanks to Juan M. Elosegui for reporting this on this SO thread and for the image):

好运!

我也遇到了同样的问题,但对我有效的解决方法是不同的。

在VS2013中打开调试> {YourWebsiteName}属性 选择“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 .运行项目

这对我很管用。

我阅读了这里所有的答案,然后,正如Mihail Shishkov回答中提到的,跳转到项目属性> Web >服务器>创建虚拟目录。这句话的效果是让我得到了一个例外:

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