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


当前回答

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应用使用相同端口)

其他回答

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

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

我的问题被解决了:

在控制面板(程序和功能)中,我发现所有与IIS相关的功能都未选中。我最终检查了所有这些并重新启动了我的系统。 然后我以管理员的身份开始了我的VS 2013,仅此而已 那时工作得很好。

在我的情况下,我允许外部请求到我的IIS Express网站,并配置windows防火墙允许iisexpress.exe,我不能从Visual Studio 2013中启动它。我仍然可以用命令行启动它,它可以很好地服务本地和外部请求。

C:\Program Files (x86)\IIS Express>iisexpress /site:MyWebSiteName

我试着创建一个防火墙规则来允许我的端口,在VS工作之后。

@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

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

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...

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