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


当前回答

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

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

这对我很管用。

其他回答

@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

在我的电脑上运行XAMPP的Apache服务器后,我也遇到了这个问题。为了运行它,我通过在管理员命令提示符上写入net stop http来终止8086端口上的所有进程。我认为杀死进程导致了这个问题。

对我来说,这个问题在完成以下步骤后就解决了;

关闭Visual Studio和SQL Management Studio。 转到服务并启动除SQL Server代理(SQLEXPRESS)之外的所有SQL服务。 转到C:\Users\<您的pc名>\Documents并删除IISExpress文件夹。 重新启动电脑。(我在上面没有发现的新事情) 启动Visual Studio并运行程序。

我最近遇到了这个问题,这是因为项目存储在网络驱动器上。由于IIS在本地作为NetworkService运行,它无法访问存储项目的网络共享。假设从网络共享打开项目违反最佳实践,我将项目复制到本地C:\ drive,然后项目按预期运行。

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

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

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


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

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

检查防病毒防火墙,允许visual studio访问网络。 例如,在nod32中:

转到设置(f5) ->网络->个人防火墙->规则和区域

在“zone and rule editor”中点击“setup”,找到vs 2010或12或…并允许访问网络。