[英]Why changing IIS Express Project URL does not work in ASP.NET MVC 4.7.2?
A few things to try;尝试一些事情;
Search through your project code (using find all) looking for instances of "5002" or whatever your port number was previously.搜索您的项目代码(使用 find all),寻找“5002”的实例或您之前的任何端口号。 You will be looking for references in generated code rather than code you have created yourself.
您将在生成的代码中查找引用,而不是您自己创建的代码。
Try with a difference browser (Chrome / Firefox etc).尝试使用不同的浏览器(Chrome / Firefox 等)。
Shut down any other running applications.关闭任何其他正在运行的应用程序。
Try running without https.尝试在没有 https 的情况下运行。 If this works you can focus your effort on getting the developer certificates working.
如果这有效,您可以将精力集中在使开发人员证书工作上。
Stop and start visual studio (its annoying how often this solves anomalies!)停止并启动visual studio(它解决异常的频率很烦人!)
Check that the IIS express instance is running in the tray - click on the tray, locate the respective running application and click browse.检查 IIS express 实例是否在托盘中运行 - 单击托盘,找到相应的运行应用程序并单击浏览。
Create a completely clean application using port 5002 and compare the two solutions to relevant differences.使用端口 5002 创建一个完全干净的应用程序,并比较两种解决方案的相关差异。
Reboot and try again - in case there are any other applications locking this port number.重新启动并重试 - 以防有任何其他应用程序锁定此端口号。
From our friends at MS support:来自我们 MS 支持的朋友:
"IISExpress uses http.sys for its communication and it requires SSL ports to be registered as Administrator. To avoid running Visual Studio as administrator, IIS Express reserves the port range 44300 - 44399 when it is installed. As long as you select a port within this range (which is what VS does) you do not need to run IISExpressAdminCmd to register the URL." "IISExpress 使用 http.sys 进行通信,它需要将 SSL 端口注册为管理员。为了避免以管理员身份运行 Visual Studio,IIS Express 在安装时保留了端口范围 44300 - 44399。只要您在其中选择一个端口在这个范围内(VS 所做的),您不需要运行 IISExpressAdminCmd 来注册 URL。”
via support link: https://developercommunity.visualstudio.com/content/problem/39430/changing-port-number-in-a-web-project-does-not-imm.html通过支持链接: https : //developercommunity.visualstudio.com/content/problem/39430/changed-port-number-in-a-web-project-does-not-imm.html
Solution #1 Use IIsExpressAdminCmd.exe to register the URL解决方案#1 使用 IIsExpressAdminCmd.exe 注册 URL
From cmd prompt go to directory C:\\Program Files (x86)\\IIS Express从 cmd 提示符转到目录 C:\\Program Files (x86)\\IIS Express
Run IISExpressAdmiCmd to register the url IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:5002/ -UseSelfSigned运行IISExpressAdmiCmd注册url IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:5002/ -UseSelfSigned
Solution #2 Run VS under admin context解决方案#2 在管理上下文下运行 VS
Solution #3 Switch the port to a pre-registered one 44300 - 44399解决方案#3 将端口切换到预先注册的端口 44300 - 44399
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.