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


当前回答

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

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

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

其他回答

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

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):

好运!

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

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

Before you try anything else, make sure you 1. restart visual studio (mostly for refreshing memory resident options from files) and 2. restart your system (mostly for invalid file locking). If your problem is such temporary or self-fixed those will do without changing anything. It worked for me with PC restart. Also if you work on a multi-user project make sure you have the latest workable version - someone else may had check in something invalid by mistake at e.g. the project file and you mess with your system for no reason. If those won't work, then you probably need to alter some setting(s) that are stuck, missing or need modification - there are plenty propositions on other answers.

我们的网站也遇到了同样的问题。我们能够在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的复选框。

除了@Yehuda Shapira给出的答案,我必须做另一个更改,即删除.csproj。用户文件中绑定信息如

<IISUrl>http://localhost:54462/</IISUrl>

存储。删除文件关闭visual Studio,然后重新构建。