我有一个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文件夹: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):
好运!
@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