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


当前回答

试试下面的步骤:

正如@Yehuda shapiro所说的那样,删除IISExpress文件夹 重新启动计算机 删除项目中的。vs文件夹

其他回答

Jason的Shavers系列文章http://jasonrshaver.com/?tag=/Client+Certificates详细解释了如何设置应用程序主机。配置站点入口,以允许应用程序运行在SSL或标准http。

他建议的一件事是为网站添加两个绑定条目。这就是我所做的。

            <bindings>
                <binding protocol="http" bindingInformation="*:59945:localhost" />
                <binding protocol="https" bindingInformation="*:44300:localhost"/>
            </bindings>

他还建议更改其他设置。我的三台机器中有两台都能用。每次我被告知在应用程序主机中手动配置站点时,通常都与绑定有关。(例如多个web应用使用相同端口)

不需要删除C:\Users[you]\Documents\IISExpress目录下的整个IISExpress文件夹。

评论:

<binding protocol="https" bindingInformation="*:8090:localhost" />

在applicationhost中。IISExpress文件夹下的config文件。

我也有同样的问题,感谢@Jacob提供的信息。

原因是-在配置文件applicationhost中错误的项目条目

C:\Users\(yourusername)\Documents\IISExpress\config 

关闭所有Visual Studio解决方案。 重命名IISExpress文件夹为一些IISExpress- copy(而不是删除你可以有一个副本) 现在再次打开VS并构建/调试项目,现在你会看到IISExpress文件夹再次为你创建了正确的配置。

在我的情况下,我在applicationHost上添加了新的站点绑定。配置文件删除后,绑定它工作正确。 applicationHost。config路径在你的项目根目录的。vs(隐藏)文件夹

我们的网站也遇到了同样的问题。我们能够在Visual Studio中解决这些问题。我们使用的是2012终极版。

我们看到的潜在问题是,由于某种原因,在启用SSL后,VS为标准url和安全url分配了相同的端口。当我们从TFS中提取代码时,这个问题似乎出现了。

为了补救,我们采取了以下步骤:

Right click the project and go to Properties -> Web Under the project URL in the Use Local IIS Web Server section, remove the "s" from the URL and Save. (EG. go from https://:44301 to http://:44301. This will allow the next step to work) In Solution Explorer, select the Project and in the Properties window (press F4 if not displayed) change SSL Enabled to False then back to True. It will generate a new port that is different from the standard URL (In my case, I have 44301 as my SSL and 44305 as my standard) Navigate back to Properties -> Web and add the "s" back to the project URL. F5 and ride!

确保未选中覆盖应用程序根URL的复选框。